void change_decl_assembler_name (tree decl, tree name) { symtab_node node = NULL; /* We can have user ASM names on things, like global register variables, that are not in the symbol table. */ if ((TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) || TREE_CODE (decl) == FUNCTION_DECL) node = symtab_get_node (decl); if (!DECL_ASSEMBLER_NAME_SET_P (decl)) { SET_DECL_ASSEMBLER_NAME (decl, name); if (node) insert_to_assembler_name_hash (node); } else { if (name == DECL_ASSEMBLER_NAME (decl)) return; if (node) unlink_from_assembler_name_hash (node); if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) && DECL_RTL_SET_P (decl)) warning (0, "%D renamed after being referenced in assembly", decl); SET_DECL_ASSEMBLER_NAME (decl, name); if (node) insert_to_assembler_name_hash (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); }
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; }
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 insert_to_assembler_name_hash (symtab_node node, bool with_clones) { if (is_a <varpool_node> (node) && DECL_HARD_REGISTER (node->symbol.decl)) return; gcc_checking_assert (!node->symbol.previous_sharing_asm_name && !node->symbol.next_sharing_asm_name); if (assembler_name_hash) { void **aslot; struct cgraph_node *cnode; tree decl = node->symbol.decl; tree name = DECL_ASSEMBLER_NAME (node->symbol.decl); aslot = htab_find_slot_with_hash (assembler_name_hash, name, decl_assembler_name_hash (name), INSERT); gcc_assert (*aslot != node); node->symbol.next_sharing_asm_name = (symtab_node)*aslot; if (*aslot != NULL) ((symtab_node)*aslot)->symbol.previous_sharing_asm_name = node; *aslot = node; /* Update also possible inline clones sharing a decl. */ cnode = dyn_cast <cgraph_node> (node); if (cnode && cnode->clones && with_clones) for (cnode = cnode->clones; cnode; cnode = cnode->next_sibling_clone) if (cnode->symbol.decl == decl) insert_to_assembler_name_hash ((symtab_node) cnode, true); } }
void symbol_table::change_decl_assembler_name (tree decl, tree name) { symtab_node *node = NULL; /* We can have user ASM names on things, like global register variables, that are not in the symbol table. */ if ((TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) || TREE_CODE (decl) == FUNCTION_DECL) node = symtab_node::get (decl); if (!DECL_ASSEMBLER_NAME_SET_P (decl)) { SET_DECL_ASSEMBLER_NAME (decl, name); if (node) insert_to_assembler_name_hash (node, true); } else { if (name == DECL_ASSEMBLER_NAME (decl)) return; tree alias = (IDENTIFIER_TRANSPARENT_ALIAS (DECL_ASSEMBLER_NAME (decl)) ? TREE_CHAIN (DECL_ASSEMBLER_NAME (decl)) : NULL); if (node) unlink_from_assembler_name_hash (node, true); if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) && DECL_RTL_SET_P (decl)) warning (0, "%D renamed after being referenced in assembly", decl); SET_DECL_ASSEMBLER_NAME (decl, name); if (alias) { IDENTIFIER_TRANSPARENT_ALIAS (name) = 1; TREE_CHAIN (name) = alias; } if (node) insert_to_assembler_name_hash (node, true); } }
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_prevail_in_asm_name_hash (symtab_node node) { unlink_from_assembler_name_hash (node, false); insert_to_assembler_name_hash (node, false); }