symtab_node symtab_node_for_asm (const_tree asmname) { symtab_node node; void **slot; if (!assembler_name_hash) { assembler_name_hash = htab_create_ggc (10, hash_node_by_assembler_name, eq_assembler_name, NULL); FOR_EACH_SYMBOL (node) insert_to_assembler_name_hash (node); } slot = htab_find_slot_with_hash (assembler_name_hash, asmname, decl_assembler_name_hash (asmname), NO_INSERT); if (slot) { node = (symtab_node) *slot; return node; } return NULL; }
/* Return varpool node assigned to DECL. Create new one when needed. */ struct varpool_node * varpool_node (tree decl) { struct varpool_node key, *node, **slot; gcc_assert (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || in_lto_p)); if (!varpool_hash) varpool_hash = htab_create_ggc (10, hash_varpool_node, eq_varpool_node, NULL); key.decl = decl; slot = (struct varpool_node **) htab_find_slot (varpool_hash, &key, INSERT); if (*slot) return *slot; node = ggc_alloc_cleared_varpool_node (); node->decl = decl; node->order = cgraph_order++; node->next = varpool_nodes; ipa_empty_ref_list (&node->ref_list); if (varpool_nodes) varpool_nodes->prev = node; varpool_nodes = node; *slot = node; return node; }
void symtab_register_node (symtab_node node) { struct symtab_node_base key; symtab_node *slot; node->symbol.next = symtab_nodes; node->symbol.previous = NULL; if (symtab_nodes) symtab_nodes->symbol.previous = node; symtab_nodes = node; if (!symtab_hash) symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL); key.decl = node->symbol.decl; slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT); if (*slot == NULL) *slot = node; insert_to_assembler_name_hash (node); node->symbol.order = symtab_order++; ipa_empty_ref_list (&node->symbol.ref_list); }
void symtab_register_node (symtab_node node) { struct symtab_node_base key; symtab_node *slot; node->symbol.next = symtab_nodes; node->symbol.previous = NULL; if (symtab_nodes) symtab_nodes->symbol.previous = node; symtab_nodes = node; if (!symtab_hash) symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL); key.decl = node->symbol.decl; slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT); if (*slot == NULL) *slot = node; ipa_empty_ref_list (&node->symbol.ref_list); node->symbol.order = symtab_order++; /* Be sure to do this last; C++ FE might create new nodes via DECL_ASSEMBLER_NAME langhook! */ insert_to_assembler_name_hash (node, false); }
static void lto_symtab_maybe_init_hash_table (void) { if (lto_symtab_identifiers) return; lto_symtab_identifiers = htab_create_ggc (1021, lto_symtab_entry_hash, lto_symtab_entry_eq, NULL); }
void symtab_insert_node_to_hashtable (symtab_node node) { struct symtab_node_base key; symtab_node *slot; if (!symtab_hash) symtab_hash = htab_create_ggc (10, hash_node, eq_node, NULL); key.decl = node->symbol.decl; slot = (symtab_node *) htab_find_slot (symtab_hash, &key, INSERT); *slot = node; }
tree mf_mark (tree t) { void **slot; if (marked_trees == NULL) marked_trees = htab_create_ggc (31, htab_hash_pointer, htab_eq_pointer, NULL); slot = htab_find_slot (marked_trees, t, INSERT); *slot = t; return t; }
void symtab_initialize_asm_name_hash (void) { symtab_node node; if (!assembler_name_hash) { assembler_name_hash = htab_create_ggc (10, hash_node_by_assembler_name, eq_assembler_name, NULL); FOR_EACH_SYMBOL (node) insert_to_assembler_name_hash (node, false); } }
void symtab_node::set_section_for_node (const char *section) { const char *current = get_section (); void **slot; if (current == section || (current && section && !strcmp (current, section))) return; if (current) { x_section->ref_count--; if (!x_section->ref_count) { slot = htab_find_slot_with_hash (symtab->section_hash, x_section->name, htab_hash_string (x_section->name), INSERT); ggc_free (x_section); htab_clear_slot (symtab->section_hash, slot); } x_section = NULL; } if (!section) { implicit_section = false; return; } if (!symtab->section_hash) symtab->section_hash = htab_create_ggc (10, hash_section_hash_entry, eq_sections, NULL); slot = htab_find_slot_with_hash (symtab->section_hash, section, htab_hash_string (section), INSERT); if (*slot) x_section = (section_hash_entry *)*slot; else { int len = strlen (section); *slot = x_section = ggc_cleared_alloc<section_hash_entry> (); x_section->name = ggc_vec_alloc<char> (len + 1); memcpy (x_section->name, section, len + 1); } x_section->ref_count++; }
static tree decl_for_type_lookup (tree type) { /* If the hash table is not initialized yet, create it now. */ if (decl_tree_for_type == NULL) { decl_tree_for_type = htab_create_ggc (10, tree_type_map_hash, tree_type_map_eq, 0); /* That also means we don't have to bother with the lookup. */ return NULL_TREE; } struct tree_type_map *h, in; in.type.from = type; h = (struct tree_type_map *) htab_find_with_hash (decl_tree_for_type, &in, TYPE_UID (type)); return h ? h->decl : NULL_TREE; }
/* Return varpool node assigned to DECL. Create new one when needed. */ struct varpool_node * varpool_node (tree decl) { struct varpool_node key, *node, **slot; gcc_assert (DECL_P (decl) && TREE_CODE (decl) != FUNCTION_DECL); if (!varpool_hash) varpool_hash = htab_create_ggc (10, hash_varpool_node, eq_varpool_node, NULL); key.decl = decl; slot = (struct varpool_node **) htab_find_slot (varpool_hash, &key, INSERT); if (*slot) return *slot; node = GGC_CNEW (struct varpool_node); node->decl = decl; node->order = cgraph_order++; node->next = varpool_nodes; varpool_nodes = node; *slot = node; return node; }
void init_shadowed_var_for_decl (void) { shadowed_var_for_decl = htab_create_ggc (512, tree_decl_map_hash, tree_decl_map_eq, 0); }