gcc/gcc/symtab.c

783 lines
21 KiB
C
Raw Normal View History

cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
/* Symbol table.
Copyright (C) 2012 Free Software Foundation, Inc.
Contributed by Jan Hubicka
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "tree-inline.h"
2012-04-18 08:54:33 +02:00
#include "langhooks.h"
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
#include "hashtab.h"
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
#include "ggc.h"
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
#include "cgraph.h"
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
#include "diagnostic.h"
#include "timevar.h"
cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c * cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c (cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Move to cgraphunit.c. (cgraph_make_decl_local): Move to symtab.c (cgraph_make_node_local_1): Update. (cgraph_can_remove_if_no_direct_calls_and): Update. (used_from_object_file_p): Update. (resolution_used_from_other_file_p): Move to symtab.c (cgraph_used_from_object_file_p): move to symtab.c (verify_cgraph_node): Verify same comdat groups. * cgraph.h (cgraph_asm_node): Rename to ... (asm_node): ... this one. (cgraph_asm_nodes): Rename to ... (asm_nodes): ... this one. (symtab_add_to_same_comdat_group): New function. (symtab_dissolve_same_comdat_group_list): New function. (symtab_used_from_object_file_p): Declare. (symtab_make_decl_local): Declare. (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Remove. (cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Remove. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one. (cgraph_optimize): Rename to .... (compile): ... this one. (add_asm_node): Declare. (fixup_same_cpp_alias_visibility): Declare. (cgraph_make_decl_local): Remove. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one. (varpool_remove_unreferenced_decls): Remove. * ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups. (preserve_function_body_p): Make static. * toplev.c (compile_file): Update comments; update. * cgraphunit.c: Update comments. (cgraph_expand_all_functions): Rename to ... (expand_all_functions): ... this one; update. (cgraph_mark_functions_to_output): Rename to ... (mark_functions_to_output): ... this one; cleanup. (cgraph_output_pending_asms): Remove prototype. (asm_nodes, asm_last_node): New static vars. (cgraph_process_new_functions): Update. (cgraph_reset_node): Cleanup; add comment. (cgraph_add_new_function): Update. (cgraph_output_pending_asms): Rename to ... (output_asm_statements): ... this one. (add_asm_node): New function. (fixup_same_cpp_alias_visibility): New function based on code in cgraph_analyze_function. (cgraph_analyze_function): Use it. (cgraph_order_sort): Update. (cgraph_output_in_order): Update. (cgraph_function_versioning): Update. (cgraph_optimize): Rename to ... (compile): ... this one; initialize streamer hooks here. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one; do not initialize streamer hook here. * lto-streamer-out.c (lto_output_toplevel_asms): Update. * dwarf2out.c: Update ocmment. * optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group. * method.c (use_thunk): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. * decl2.c (maybe_emit_vtables): Likewise. (cp_write_global_declarations): Use finalize_compilation_unit. * parser.c (cp_parser_asm_definition): Use add_asm_node. * lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node * c-decl.c (c_write_global_declarations): Use finalize_compilation_unit. * langhooks.c (write_global_declarations): Update. * ipa.c (cgraph_externally_visible_p): Update. (dissolve_same_comdat_group_list): Remove. (function_and_variable_visibility): Update. * symtab.c: Inlcude lto-streamer.h and rtl.h (ld_plugin_symbol_resolution_names): New. (symtab_add_to_same_comdat_group): New. (symtab_dissolve_same_comdat_group_list): New. (resolution_used_from_other_file_p): Move here from cgraph.c (symtab_used_from_object_file_p): New. (symtab_make_decl_local): New. * passes.c (register_pass): Update comments. * c-parser.c (c_parser_asm_definition): Update. * varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility. (varpool_remove_unreferenced_decls): Make static. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one; call varpool_remove_unreferenced_decls. (varpool_used_from_object_file_p): Remove. * gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit. * gcc-interface/utils.c (rest_of_subprog_body_compilation): Update comment. (gnat_write_global_declarations): Use finalize_compilation_unit. * f95-lang.c (gfc_finish): Update comments. * lto.c (lto_main): Use compile (). * lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p. (partition_varpool_node_p): Likewise. From-SVN: r186998
2012-04-30 19:55:29 +02:00
#include "lto-streamer.h"
#include "rtl.h"
const char * const ld_plugin_symbol_resolution_names[]=
{
"",
"undef",
"prevailing_def",
"prevailing_def_ironly",
"preempted_reg",
"preempted_ir",
"resolved_ir",
"resolved_exec",
"resolved_dyn",
"prevailing_def_ironly_exp"
};
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
/* Hash table used to convert declarations into nodes. */
static GTY((param_is (union symtab_node_def))) htab_t symtab_hash;
/* Hash table used to convert assembler names into nodes. */
static GTY((param_is (union symtab_node_def))) htab_t assembler_name_hash;
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
/* Linked list of symbol table nodes. */
symtab_node symtab_nodes;
/* The order index of the next symtab node to be created. This is
used so that we can sort the cgraph nodes in order by when we saw
them, to support -fno-toplevel-reorder. */
int symtab_order;
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
/* Returns a hash code for P. */
static hashval_t
hash_node (const void *p)
{
const_symtab_node n = (const_symtab_node ) p;
return (hashval_t) DECL_UID (n->symbol.decl);
}
/* Returns nonzero if P1 and P2 are equal. */
static int
eq_node (const void *p1, const void *p2)
{
const_symtab_node n1 = (const_symtab_node) p1;
const_symtab_node n2 = (const_symtab_node) p2;
return DECL_UID (n1->symbol.decl) == DECL_UID (n2->symbol.decl);
}
/* Returns a hash code for P. */
static hashval_t
hash_node_by_assembler_name (const void *p)
{
const_symtab_node n = (const_symtab_node) p;
return (hashval_t) decl_assembler_name_hash (DECL_ASSEMBLER_NAME (n->symbol.decl));
}
/* Returns nonzero if P1 and P2 are equal. */
static int
eq_assembler_name (const void *p1, const void *p2)
{
const_symtab_node n1 = (const_symtab_node) p1;
const_tree name = (const_tree)p2;
return (decl_assembler_name_equal (n1->symbol.decl, name));
}
/* Insert NODE to assembler name hash. */
static void
insert_to_assembler_name_hash (symtab_node node)
{
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
if (symtab_variable_p (node) && DECL_HARD_REGISTER (node->symbol.decl))
return;
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
gcc_checking_assert (!node->symbol.previous_sharing_asm_name
&& !node->symbol.next_sharing_asm_name);
if (assembler_name_hash)
{
void **aslot;
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;
}
}
/* Remove NODE from assembler name hash. */
static void
unlink_from_assembler_name_hash (symtab_node node)
{
if (assembler_name_hash)
{
if (node->symbol.next_sharing_asm_name)
node->symbol.next_sharing_asm_name->symbol.previous_sharing_asm_name
= node->symbol.previous_sharing_asm_name;
if (node->symbol.previous_sharing_asm_name)
{
node->symbol.previous_sharing_asm_name->symbol.next_sharing_asm_name
= node->symbol.next_sharing_asm_name;
}
else
{
tree name = DECL_ASSEMBLER_NAME (node->symbol.decl);
void **slot;
slot = htab_find_slot_with_hash (assembler_name_hash, name,
decl_assembler_name_hash (name),
NO_INSERT);
gcc_assert (*slot == node);
if (!node->symbol.next_sharing_asm_name)
htab_clear_slot (assembler_name_hash, slot);
else
*slot = node->symbol.next_sharing_asm_name;
}
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
node->symbol.next_sharing_asm_name = NULL;
node->symbol.previous_sharing_asm_name = NULL;
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
}
}
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
/* Arrange node to be first in its entry of assembler_name_hash. */
void
symtab_prevail_in_asm_name_hash (symtab_node node)
{
unlink_from_assembler_name_hash (node);
insert_to_assembler_name_hash (node);
}
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
/* Add node into symbol table. This function is not used directly, but via
cgraph/varpool node creation routines. */
void
symtab_register_node (symtab_node node)
{
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
struct symtab_node_base key;
symtab_node *slot;
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
node->symbol.next = symtab_nodes;
node->symbol.previous = NULL;
if (symtab_nodes)
symtab_nodes->symbol.previous = node;
symtab_nodes = node;
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
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);
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
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);
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
}
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
/* Make NODE to be the one symtab hash is pointing to. Used when reshaping tree
of inline clones. */
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;
}
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
/* Remove node from symbol table. This function is not used directly, but via
cgraph/varpool node removal routines. */
void
symtab_unregister_node (symtab_node node)
{
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
void **slot;
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
ipa_remove_all_references (&node->symbol.ref_list);
lto-symtab.c (lto_cgraph_replace_node): Update. * lto-symtab.c (lto_cgraph_replace_node): Update. * cgraphbuild.c (record_reference, record_type_list, record_eh_tables, mark_address, mark_load, mark_store): Update. * cgraph.c (cgraph_same_body_alias, dump_cgraph_node, cgraph_create_virtual_clone, cgraph_for_node_thunks_and_aliases): Update. * cgraph.h (symtab_node_def, symtab_node, const_symtab_node): Remove. (cgraph_alias_aliased_node, varpool_alias_aliased_node): Update. * reload.c: Fix typo in comment. * rtlanal.c: Likewise. * tree-emultls.c (gen_emutls_addr): Update. * ipa-reference.c (analyze_function): Update. * cgraphunit.c (cgraph_analyze_function, cgraph_process_same_body_aliases, assemble_thunks_and_aliases): Update. * ipa-ref.c (ipa_record_reference): Reorg to avoid reference types. (ipa_remove_reference): Likewise. (ipa_remove_all_refering): Rename to ... (ipa_remove_all_referring): ... this one; update. (ipa_dump_references): Update. (ipa_dump_referring): Update. (ipa_clone_references): Update. (ipa_clone_refering): Rename to ... (ipa_clone_referring): ... this one; update. (ipa_ref_cannot_lead_to_return): Update. (ipa_ref_has_aliases_p): Update. * ipa-ref.h (symtab_node_def, symtab_node, const_symtab_node): New forward typedefs. (ipa_ref_type): Remove. (ipa_ref_ptr_u): Remove. (ipa_ref): Remove referencing, refered, refered_index, refering_type and refered_type; add referring, referred and referred_index. (ipa_ref_list): Rename refering to referring. (ipa_record_reference, ipa_remove_all_referring, ipa_dump_referring, ipa_clone_references, ipa_clone_referring): Update prototypes. * lto-cgraph.c (referenced_from_other_partition_p): Update. (lto_output_ref): Update. (add_references): Update. (input_varpool_node): Update. (input_refs): Update. * ipa-ref-inline.h (ipa_ref_node): Update. (ipa_ref_varpool_node): Update. (ipa_ref_referring_node); Update. (ipa_ref_referring_varpool_node): Update. (ipa_ref_referring_ref_list); Update. (ipa_ref_referred_ref_list): Update. (ipa_ref_list_first_referring): Update. (ipa_empty_ref_list): Update. (ipa_ref_list_refering_iterate): Rename to ... (ipa_ref_list_referring_iterate): ... this one. * cse.c: Update comment. * ipa-utils.c (ipa_reverse_postorder): Update. * tree-ssa-alias.c: Update. * ipa-inline.c (reset_edge_caches): Update. (update_caller_keys): Update. * ipa-inline.h: Update comments. * jump.c: Update comment. * alias.c: Likewise. * ipa.c (process_references): Update. (cgraph_remove_unreachable_nodes): Likewise. (ipa_discover_readonly_nonaddressable_var): Likewise. (cgraph_address_taken_from_non_vtable_p): Likewise. * trans-mem.c (ipa_tm_execute): Update. * simplify-rtx.c: Fix comment. * rtl.c: Fix comment. * symtab.c (symtab_unregister_node): Update. * varpool.c (dump_varpool_node): Update. (varpool_analyze_pending_decls): Update. (assemble_aliases): Update. (varpool_for_node_and_aliases): Update. From-SVN: r186564
2012-04-18 11:57:53 +02:00
ipa_remove_all_referring (&node->symbol.ref_list);
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
if (node->symbol.same_comdat_group)
{
symtab_node prev;
for (prev = node->symbol.same_comdat_group;
prev->symbol.same_comdat_group != node;
prev = prev->symbol.same_comdat_group)
;
if (node->symbol.same_comdat_group == prev)
prev->symbol.same_comdat_group = NULL;
else
prev->symbol.same_comdat_group = node->symbol.same_comdat_group;
node->symbol.same_comdat_group = NULL;
}
if (node->symbol.previous)
node->symbol.previous->symbol.next = node->symbol.next;
else
symtab_nodes = node->symbol.next;
if (node->symbol.next)
node->symbol.next->symbol.previous = node->symbol.previous;
node->symbol.next = NULL;
node->symbol.previous = NULL;
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
slot = htab_find_slot (symtab_hash, node, NO_INSERT);
if (*slot == node)
{
symtab_node replacement_node = NULL;
if (symtab_function_p (node))
replacement_node = (symtab_node)cgraph_find_replacement_node (cgraph (node));
if (!replacement_node)
htab_clear_slot (symtab_hash, slot);
else
*slot = replacement_node;
}
unlink_from_assembler_name_hash (node);
}
/* Return symbol table node associated with DECL, if any,
and NULL otherwise. */
symtab_node
symtab_get_node (const_tree decl)
{
symtab_node *slot;
struct symtab_node_base key;
gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
|| in_lto_p)));
if (!symtab_hash)
return NULL;
key.decl = CONST_CAST2 (tree, const_tree, decl);
slot = (symtab_node *) htab_find_slot (symtab_hash, &key,
NO_INSERT);
if (slot)
return *slot;
return NULL;
cgraph.h (symtab_node_base): Add next and previous pointers. * cgraph.h (symtab_node_base): Add next and previous pointers. (cgraph_node): Remove next and preivous pointers. (varpool_node): Likewise; remove next/previous GTY marker; it is not type safe. (symtab_node_def): Update GTY marker (x_cgraph_nodes, cgraph_nodes): Remove. (symtab_nodes): New function. (cgraph_order): Rename to ... (symtab_order): ... this one. (symtab_register_node, symtab_unregister_node, symtab_remove_node): Declare. (x_varpool_nodes, varpool_nodes): Remove. (FOR_EACH_STATIC_VARIABLE): Update. (symtab_function_p, symtab_variable_p): New function. (FOR_EACH_VARIABLE): Update. (varpool_first_variable, varpool_next_variable): New functions. (FOR_EACH_VARIABLE): Update. (cgraph_first_defined_function): Update. (cgraph_next_defined_function, cgraph_next_defined_function): Update. (FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update. (cgraph_first_function, cgraph_next_function): New. (FOR_EACH_FUNCTION): Update. (cgraph_first_function_with_gimple_body, cgraph_next_function_with_gimple_body): Update. * symtab.c: New file. * cgraph.c: Update copyright dates. (x_cgraph_nodes, cgraph_order): Remove. (NEXT_FREE_NODE): Update. (SET_NEXT_FREE_NODE): New. (cgraph_create_node_1): Remove common code. (cgraph_create_node); Remove common code; call symtab_register_node. (cgraph_remove_node): Remove common code; call symtab_unregister-node. (cgraph_add_asm_node); update. (cgraph_clone_node): Register new node. * cgraphunit.c (process_function_and_variable_attributes): Update. (cgraph_analyze_functions): Update. (cgraph_analyze_functions): Update. (cgraph_output_in_order): Update. * lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update. * ipa-inline.c (recursive_inlining); update. * lto-streamer-in.c (lto_input_toplevel_asms); Update. * ipa.c (cgraph_remove_unreachable_nodes): Update. * Makefile.in: Add symtab.o * varpool.c (x_varpool_nodes): Remove (varpool_node): Remove common code; call symtab_register_node. (varpool_remove_node); Remove common code; call symtab_unregister_node. From-SVN: r186496
2012-04-16 16:34:22 +02:00
}
/* Remove symtab NODE from the symbol table. */
void
symtab_remove_node (symtab_node node)
{
if (symtab_function_p (node))
cgraph_remove_node (cgraph (node));
else if (symtab_variable_p (node))
varpool_remove_node (varpool (node));
}
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
/* Initalize asm name hash unless. */
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
void
symtab_initialize_asm_name_hash (void)
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
{
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);
}
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
}
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
/* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
Return NULL if there's no such node. */
symtab_node
symtab_node_for_asm (const_tree asmname)
{
symtab_node node;
void **slot;
symtab_initialize_asm_name_hash ();
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
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;
}
/* Set the DECL_ASSEMBLER_NAME and update symtab hashtables. */
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);
}
}
cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c * cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c (cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Move to cgraphunit.c. (cgraph_make_decl_local): Move to symtab.c (cgraph_make_node_local_1): Update. (cgraph_can_remove_if_no_direct_calls_and): Update. (used_from_object_file_p): Update. (resolution_used_from_other_file_p): Move to symtab.c (cgraph_used_from_object_file_p): move to symtab.c (verify_cgraph_node): Verify same comdat groups. * cgraph.h (cgraph_asm_node): Rename to ... (asm_node): ... this one. (cgraph_asm_nodes): Rename to ... (asm_nodes): ... this one. (symtab_add_to_same_comdat_group): New function. (symtab_dissolve_same_comdat_group_list): New function. (symtab_used_from_object_file_p): Declare. (symtab_make_decl_local): Declare. (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Remove. (cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Remove. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one. (cgraph_optimize): Rename to .... (compile): ... this one. (add_asm_node): Declare. (fixup_same_cpp_alias_visibility): Declare. (cgraph_make_decl_local): Remove. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one. (varpool_remove_unreferenced_decls): Remove. * ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups. (preserve_function_body_p): Make static. * toplev.c (compile_file): Update comments; update. * cgraphunit.c: Update comments. (cgraph_expand_all_functions): Rename to ... (expand_all_functions): ... this one; update. (cgraph_mark_functions_to_output): Rename to ... (mark_functions_to_output): ... this one; cleanup. (cgraph_output_pending_asms): Remove prototype. (asm_nodes, asm_last_node): New static vars. (cgraph_process_new_functions): Update. (cgraph_reset_node): Cleanup; add comment. (cgraph_add_new_function): Update. (cgraph_output_pending_asms): Rename to ... (output_asm_statements): ... this one. (add_asm_node): New function. (fixup_same_cpp_alias_visibility): New function based on code in cgraph_analyze_function. (cgraph_analyze_function): Use it. (cgraph_order_sort): Update. (cgraph_output_in_order): Update. (cgraph_function_versioning): Update. (cgraph_optimize): Rename to ... (compile): ... this one; initialize streamer hooks here. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one; do not initialize streamer hook here. * lto-streamer-out.c (lto_output_toplevel_asms): Update. * dwarf2out.c: Update ocmment. * optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group. * method.c (use_thunk): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. * decl2.c (maybe_emit_vtables): Likewise. (cp_write_global_declarations): Use finalize_compilation_unit. * parser.c (cp_parser_asm_definition): Use add_asm_node. * lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node * c-decl.c (c_write_global_declarations): Use finalize_compilation_unit. * langhooks.c (write_global_declarations): Update. * ipa.c (cgraph_externally_visible_p): Update. (dissolve_same_comdat_group_list): Remove. (function_and_variable_visibility): Update. * symtab.c: Inlcude lto-streamer.h and rtl.h (ld_plugin_symbol_resolution_names): New. (symtab_add_to_same_comdat_group): New. (symtab_dissolve_same_comdat_group_list): New. (resolution_used_from_other_file_p): Move here from cgraph.c (symtab_used_from_object_file_p): New. (symtab_make_decl_local): New. * passes.c (register_pass): Update comments. * c-parser.c (c_parser_asm_definition): Update. * varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility. (varpool_remove_unreferenced_decls): Make static. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one; call varpool_remove_unreferenced_decls. (varpool_used_from_object_file_p): Remove. * gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit. * gcc-interface/utils.c (rest_of_subprog_body_compilation): Update comment. (gnat_write_global_declarations): Use finalize_compilation_unit. * f95-lang.c (gfc_finish): Update comments. * lto.c (lto_main): Use compile (). * lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p. (partition_varpool_node_p): Likewise. From-SVN: r186998
2012-04-30 19:55:29 +02:00
/* Add NEW_ to the same comdat group that OLD is in. */
void
symtab_add_to_same_comdat_group (symtab_node new_node,
symtab_node old_node)
{
gcc_assert (DECL_ONE_ONLY (old_node->symbol.decl));
gcc_assert (!new_node->symbol.same_comdat_group);
gcc_assert (new_node != old_node);
DECL_COMDAT_GROUP (new_node->symbol.decl) = DECL_COMDAT_GROUP (old_node->symbol.decl);
new_node->symbol.same_comdat_group = old_node;
if (!old_node->symbol.same_comdat_group)
old_node->symbol.same_comdat_group = new_node;
else
{
symtab_node n;
for (n = old_node->symbol.same_comdat_group;
n->symbol.same_comdat_group != old_node;
n = n->symbol.same_comdat_group)
;
n->symbol.same_comdat_group = new_node;
}
}
/* Dissolve the same_comdat_group list in which NODE resides. */
void
symtab_dissolve_same_comdat_group_list (symtab_node node)
{
symtab_node n = node, next;
if (!node->symbol.same_comdat_group)
return;
do
{
next = n->symbol.same_comdat_group;
n->symbol.same_comdat_group = NULL;
n = next;
}
while (n != node);
}
2012-04-18 08:54:33 +02:00
/* Return printable assembler name of NODE.
This function is used only for debugging. When assembler name
is unknown go with identifier name. */
const char *
symtab_node_asm_name (symtab_node node)
{
if (!DECL_ASSEMBLER_NAME_SET_P (node->symbol.decl))
return lang_hooks.decl_printable_name (node->symbol.decl, 2);
return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl));
}
/* Return printable identifier name. */
const char *
symtab_node_name (symtab_node node)
{
return lang_hooks.decl_printable_name (node->symbol.decl, 2);
}
static const char * const symtab_type_names[] = {"symbol", "function", "variable"};
/* Dump base fields of symtab nodes. Not to be used directly. */
void
dump_symtab_base (FILE *f, symtab_node node)
{
static const char * const visibility_types[] = {
"default", "protected", "hidden", "internal"
};
fprintf (f, "%s/%i (%s)",
symtab_node_asm_name (node),
node->symbol.order,
symtab_node_name (node));
dump_addr (f, " @", (void *)node);
fprintf (f, "\n Type: %s\n", symtab_type_names[node->symbol.type]);
fprintf (f, " Visibility:");
if (node->symbol.in_other_partition)
fprintf (f, " in_other_partition");
if (node->symbol.used_from_other_partition)
fprintf (f, " used_from_other_partition");
lto-symtab.c (lto_cgraph_replace_node): Merge needed instead of force flags. * lto-symtab.c (lto_cgraph_replace_node): Merge needed instead of force flags. * cgraph.c (cgraph_add_thunk): Use mark_reachable_node. (cgraph_remove_node): Update. (cgraph_mark_needed_node): Remove. (cgraph_mark_force_output_node): New. (dump_cgraph_node): Do not dump needed flag. (cgraph_node_cannot_be_local_p_1): Update. (cgraph_can_remove_if_no_direct_calls_and_refs): Update. * cgraph.h (symtab_node_base): Add force_output flag. (cgraph_node): Remove needed flag. (varpool_node): Remove force_output flag. (cgraph_mark_needed_node): Remove. (cgraph_mark_force_output_node): New. (cgraph_only_called_directly_or_aliased_p, varpool_can_remove_if_no_refs, varpool_all_refs_explicit_p): Update. * ipa-cp.c (ipcp_generate_summary): Remove out of date assert. * cgraphunit.c (cgraph_decide_is_function_needed): rewrite. (cgraph_add_new_function); Update. (cgraph_mark_if_needed); Update. (verify_cgraph_node): Update. (cgraph_analyze_function): Alias target is reachable. (process_function_and_variable_attributes): Update: externally_visible flag makes function reachable. (cgraph_analyze_functions): Update dumping. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Update streaming. * lto-streamer-out.c (produce_symtab): Use force_output. * ipa.c (process_references): Weakrefs must be processed. (cgraph_remove_unreachable_nodes): Likewise; update for new force_output flag. (varpool_externally_visible_p); Weakrefs are externally visible even if they are not. (function_and_variable_visibility): Update; when processing alias pair force the targets to be output. (whole_program_function_and_variable_visility): Use mark_reachable_node. * trans-mem.c (ipa_tm_mark_needed_node): Remove (ipa_tm_mark_force_output_node): New function. (ipa_tm_create_version_alias, ipa_tm_create_version): Update. * gimple-fold.c (can_refer_decl_in_current_unit_p): Be lax about aliases. * varasm.c (mark_decl_referenced): Update. (find_decl_and_mark_needed): Remove. (find_decl): New function. (weak_finish, finish_aliases_1, assemble_alias): Update; do not mark alias targets as needed. (dump_tm_clone_pairs): Update. * tree-inline.c (copy_bb): Update check. * symtab.c (dump_symtab_base): Dump force_output. * tree-ssa-structalias.c (ipa_pta_execute): Use force_output. * passes.c (execute_todo): Fix dumping. * varpool.c (decide_is_variable_needed, varpool_finalize_decl): Update. (varpool_analyze_pending_decls): Alias target is reachable. (varpool_create_variable_alias): Finalize weakrefs. * class.c (make_local_function_alias): Do not mark symbol referenced. * objc-acct.c (mark_referenced_methods); Use cgraph_mark_force_output_node. * gcc-interface/utils.c (gnat_write_global_declarations): Update for new force_output placement. * lto/lto-partition.c (partition_cgraph_node_p): Use force_output. From-SVN: r186624
2012-04-20 16:09:11 +02:00
if (node->symbol.force_output)
fprintf (f, " force_output");
2012-04-18 08:54:33 +02:00
if (node->symbol.resolution != LDPR_UNKNOWN)
fprintf (f, " %s",
ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]);
if (TREE_ASM_WRITTEN (node->symbol.decl))
fprintf (f, " asm_written");
if (DECL_EXTERNAL (node->symbol.decl))
fprintf (f, " external");
if (TREE_PUBLIC (node->symbol.decl))
fprintf (f, " public");
if (DECL_COMMON (node->symbol.decl))
fprintf (f, " common");
if (DECL_WEAK (node->symbol.decl))
fprintf (f, " weak");
if (DECL_DLLIMPORT_P (node->symbol.decl))
fprintf (f, " dll_import");
if (DECL_COMDAT (node->symbol.decl))
fprintf (f, " comdat");
if (DECL_COMDAT_GROUP (node->symbol.decl))
fprintf (f, " comdat_group:%s",
IDENTIFIER_POINTER (DECL_COMDAT_GROUP (node->symbol.decl)));
if (DECL_ONE_ONLY (node->symbol.decl))
fprintf (f, " one_only");
if (DECL_SECTION_NAME (node->symbol.decl))
fprintf (f, " section_name:%s",
TREE_STRING_POINTER (DECL_SECTION_NAME (node->symbol.decl)));
2012-04-18 08:54:33 +02:00
if (DECL_VISIBILITY_SPECIFIED (node->symbol.decl))
fprintf (f, " visibility_specified");
if (DECL_VISIBILITY (node->symbol.decl))
fprintf (f, " visibility:%s",
visibility_types [DECL_VISIBILITY (node->symbol.decl)]);
if (DECL_VIRTUAL_P (node->symbol.decl))
fprintf (f, " virtual");
if (DECL_ARTIFICIAL (node->symbol.decl))
fprintf (f, " artificial");
if (TREE_CODE (node->symbol.decl) == FUNCTION_DECL)
{
if (DECL_STATIC_CONSTRUCTOR (node->symbol.decl))
fprintf (f, " constructor");
if (DECL_STATIC_DESTRUCTOR (node->symbol.decl))
fprintf (f, " destructor");
}
2012-04-18 08:54:33 +02:00
fprintf (f, "\n");
if (node->symbol.same_comdat_group)
fprintf (f, " Same comdat group as: %s/%i\n",
symtab_node_asm_name (node->symbol.same_comdat_group),
node->symbol.same_comdat_group->symbol.order);
if (node->symbol.next_sharing_asm_name)
fprintf (f, " next sharing asm name: %i\n",
node->symbol.next_sharing_asm_name->symbol.order);
2012-04-18 08:54:33 +02:00
if (node->symbol.previous_sharing_asm_name)
fprintf (f, " previous sharing asm name: %i\n",
node->symbol.previous_sharing_asm_name->symbol.order);
2012-04-18 08:54:33 +02:00
if (node->symbol.address_taken)
fprintf (f, " Address is taken.\n");
lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags. * lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags. * cgraphbuild.c (record_reference, record_type_list, mark_address, mark_load, mark_store): Do not mark varpool nodes as needed. * cgraph.c (cgraph_new_nodes): Remove. (cgraph_create_function_alias): Do not mark nodes as reachable. (cgraph_add_thunk): Likewise. (cgraph_mark_reachable_node): Do not manage the queue. * cgraph.h (cgraph_node): Remove next_needed. (varpool_nodes_queue): Remove next_needed and prev_needed. (x_cgraph_nodes_queue, x_cgraph_nodes_queue, cgraph_new_nodes): Remove. (cgraph_new_nodes): Declare. (x_varpool_nodes_queue, varpool_nodes_queue); Remove. (varpool_analyze_pending_decls): Remove. (varpool_analyze_node): New. (varpool_mark_needed_node): Remove. (varpool_first_variable, varpool_next_variable): New inlines. (varpool_first_static_initializer, varpool_next_static_initializer): Update. (FOR_EACH_STATIC_VARIABLE): Remove unused walker. (varpool_first_defined_variable): New inline. (varpool_next_defined_variable): New inline (FOR_EACH_VARIABLE): Reimplement. (FOR_EACH_DEFINED_VARIABLE): Reimplement. * toplev.c (wrapup_global_declaration_2): Use analyzed instead of needed flag. * cgraphunit.c (cgraph_new_nodes): Declare here. (enqueue_node): New function. (cgraph_process_new_functions): update for new node set; when constructing cgraph enqueue node for processing. (cgraph_add_new_function): Use new node set. (process_function_and_variable_attributes): Do not set varpool needed flags. (referred_to_p): New function. (varpool_finalize_decl): Move here from varpool.c; enqueue needed node when varpool is in construction. (cgraph_analyze_functions): Rewrite. (cgraph_expand_all_functions): Update. (cgraph_output_in_order): Do not analyze pending decls; do not set needed flags. (cgraph_optimize): Do not analyze pending decls. * lto-cgraph.c (input_varpool_node): Clear analyzed flag for objects in other partition; do not mark node as needed. * dwarf2out.c (reference_to_unused): Use analyzed flag. (premark_types_used_by_global_vars_helper): Likewise. * ipa.c (process_references): Do not call varpool_mark_needed_node. (cgraph_remove_unreachable_nodes): Do not rely on varpool and cgrpah queues. (function_and_variable_visibility): Do not mark node as needed. (whole_program_function_and_variable_visibility): Likewise. * Makefile.in (gt-varpool.h): No longer needed. * passes.c (execute_one_pass, execute_ipa_pass_list): Update. (ipa_write_summaries): Do not use needed flag. * varpool.c: Do not include gt-varpool.h (x_varpool_nodes_queue, x_varpool_last_needed_node, x_varpool_last_needed_node, x_varpool_first_unanalyzed_node, x_varpool_first_unanalyzed_node, varpool_assembled_nodes_queue): Remove. (varpool_remove_node): Do not update the lists. (dump_varpool_node): Do not dump needed flag. (varpool_enqueue_needed_node): Remove. (varpool_mark_needed_node): Remove. (varpool_reset_queue): Remove. (varpool_finalize_decl): Move to cgraphunit.c (varpool_analyze_node): New functions based on former varpool_analyze_pending_decls. (varpool_analyze_pending_decls): Remove. (varpool_assemble_decl): Do not update the lists. (enqueue_node): New function. (varpool_remove_unreferenced_decls): Rewrite. (varpool_empty_needed_queue): Remove. (add_new_static_var): Do not mark node as needed. (varpool_create_variable_alias): Handle expansion state creation. * except.c (output_ttype): Do not mark node as needed. * varasm.c (mark_decl_referenced): Do not use mark_needed_node. * tree-profile.c (init_ic_make_global_vars, init_ic_make_global_vars): Likewise. * tree-switch-conversion.c (build_one_array): Likewise. * class.c (build_utf8_ref): Do not mark varpool node as needed. * gcc-interface/utils.c (gnat_write_global_declarations): Do not mark needed node. * lto-partition.c (partition_varpool_node_p): Do not use needed flag. * decl2.c (maybe_make_one_only): Mark keyed COMDATs as USED so they gets finalized. From-SVN: r186687
2012-04-22 23:28:07 +02:00
if (node->symbol.aux)
{
fprintf (f, " Aux:");
dump_addr (f, " @", (void *)node->symbol.aux);
}
2012-04-18 08:54:33 +02:00
fprintf (f, " References: ");
ipa_dump_references (f, &node->symbol.ref_list);
lto-symtab.c (lto_cgraph_replace_node): Update. * lto-symtab.c (lto_cgraph_replace_node): Update. * cgraphbuild.c (record_reference, record_type_list, record_eh_tables, mark_address, mark_load, mark_store): Update. * cgraph.c (cgraph_same_body_alias, dump_cgraph_node, cgraph_create_virtual_clone, cgraph_for_node_thunks_and_aliases): Update. * cgraph.h (symtab_node_def, symtab_node, const_symtab_node): Remove. (cgraph_alias_aliased_node, varpool_alias_aliased_node): Update. * reload.c: Fix typo in comment. * rtlanal.c: Likewise. * tree-emultls.c (gen_emutls_addr): Update. * ipa-reference.c (analyze_function): Update. * cgraphunit.c (cgraph_analyze_function, cgraph_process_same_body_aliases, assemble_thunks_and_aliases): Update. * ipa-ref.c (ipa_record_reference): Reorg to avoid reference types. (ipa_remove_reference): Likewise. (ipa_remove_all_refering): Rename to ... (ipa_remove_all_referring): ... this one; update. (ipa_dump_references): Update. (ipa_dump_referring): Update. (ipa_clone_references): Update. (ipa_clone_refering): Rename to ... (ipa_clone_referring): ... this one; update. (ipa_ref_cannot_lead_to_return): Update. (ipa_ref_has_aliases_p): Update. * ipa-ref.h (symtab_node_def, symtab_node, const_symtab_node): New forward typedefs. (ipa_ref_type): Remove. (ipa_ref_ptr_u): Remove. (ipa_ref): Remove referencing, refered, refered_index, refering_type and refered_type; add referring, referred and referred_index. (ipa_ref_list): Rename refering to referring. (ipa_record_reference, ipa_remove_all_referring, ipa_dump_referring, ipa_clone_references, ipa_clone_referring): Update prototypes. * lto-cgraph.c (referenced_from_other_partition_p): Update. (lto_output_ref): Update. (add_references): Update. (input_varpool_node): Update. (input_refs): Update. * ipa-ref-inline.h (ipa_ref_node): Update. (ipa_ref_varpool_node): Update. (ipa_ref_referring_node); Update. (ipa_ref_referring_varpool_node): Update. (ipa_ref_referring_ref_list); Update. (ipa_ref_referred_ref_list): Update. (ipa_ref_list_first_referring): Update. (ipa_empty_ref_list): Update. (ipa_ref_list_refering_iterate): Rename to ... (ipa_ref_list_referring_iterate): ... this one. * cse.c: Update comment. * ipa-utils.c (ipa_reverse_postorder): Update. * tree-ssa-alias.c: Update. * ipa-inline.c (reset_edge_caches): Update. (update_caller_keys): Update. * ipa-inline.h: Update comments. * jump.c: Update comment. * alias.c: Likewise. * ipa.c (process_references): Update. (cgraph_remove_unreachable_nodes): Likewise. (ipa_discover_readonly_nonaddressable_var): Likewise. (cgraph_address_taken_from_non_vtable_p): Likewise. * trans-mem.c (ipa_tm_execute): Update. * simplify-rtx.c: Fix comment. * rtl.c: Fix comment. * symtab.c (symtab_unregister_node): Update. * varpool.c (dump_varpool_node): Update. (varpool_analyze_pending_decls): Update. (assemble_aliases): Update. (varpool_for_node_and_aliases): Update. From-SVN: r186564
2012-04-18 11:57:53 +02:00
fprintf (f, " Referring: ");
ipa_dump_referring (f, &node->symbol.ref_list);
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
if (node->symbol.lto_file_data)
fprintf (f, " Read from file: %s\n",
node->symbol.lto_file_data->file_name);
2012-04-18 08:54:33 +02:00
}
/* Dump symtab node. */
void
dump_symtab_node (FILE *f, symtab_node node)
{
if (symtab_function_p (node))
dump_cgraph_node (f, cgraph (node));
else if (symtab_variable_p (node))
dump_varpool_node (f, varpool (node));
}
/* Dump symbol table. */
void
dump_symtab (FILE *f)
{
symtab_node node;
fprintf (f, "Symbol table:\n\n");
FOR_EACH_SYMBOL (node)
dump_symtab_node (f, node);
}
/* Dump symtab node NODE to stderr. */
DEBUG_FUNCTION void
debug_symtab_node (symtab_node node)
{
dump_symtab_node (stderr, node);
}
/* Dump symbol table to stderr. */
DEBUG_FUNCTION void
debug_symtab (void)
{
dump_symtab (stderr);
}
/* Verify common part of symtab nodes. */
DEBUG_FUNCTION bool
verify_symtab_base (symtab_node node)
{
bool error_found = false;
symtab_node hashed_node;
if (symtab_function_p (node))
{
if (TREE_CODE (node->symbol.decl) != FUNCTION_DECL)
{
error ("function symbol is not function");
error_found = true;
}
}
else if (symtab_variable_p (node))
{
if (TREE_CODE (node->symbol.decl) != VAR_DECL)
{
error ("variable symbol is not variable");
error_found = true;
}
}
else
{
error ("node has unknown type");
error_found = true;
}
hashed_node = symtab_get_node (node->symbol.decl);
if (!hashed_node)
{
error ("node not found in symtab decl hashtable");
error_found = true;
}
if (assembler_name_hash)
{
hashed_node = symtab_node_for_asm (DECL_ASSEMBLER_NAME (node->symbol.decl));
if (hashed_node && hashed_node->symbol.previous_sharing_asm_name)
{
error ("assembler name hash list corrupted");
error_found = true;
}
while (hashed_node)
{
if (hashed_node == node)
break;
hashed_node = hashed_node->symbol.next_sharing_asm_name;
}
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
if (!hashed_node
&& !(symtab_variable_p (node) || DECL_HARD_REGISTER (node->symbol.decl)))
{
error ("node not found in symtab assembler name hash");
error_found = true;
}
}
if (node->symbol.previous_sharing_asm_name
&& node->symbol.previous_sharing_asm_name->symbol.next_sharing_asm_name != node)
{
error ("double linked list of assembler names corrupted");
}
if (node->symbol.same_comdat_group)
{
symtab_node n = node->symbol.same_comdat_group;
if (!DECL_ONE_ONLY (n->symbol.decl))
{
error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
error_found = true;
}
if (n->symbol.type != node->symbol.type)
{
error ("mixing different types of symbol in same comdat groups is not supported");
error_found = true;
}
if (n == node)
{
error ("node is alone in a comdat group");
error_found = true;
}
do
{
if (!n->symbol.same_comdat_group)
{
error ("same_comdat_group is not a circular list");
error_found = true;
break;
}
n = n->symbol.same_comdat_group;
}
while (n != node);
}
return error_found;
}
/* Verify consistency of NODE. */
DEBUG_FUNCTION void
verify_symtab_node (symtab_node node)
{
if (seen_error ())
return;
timevar_push (TV_CGRAPH_VERIFY);
if (symtab_function_p (node))
verify_cgraph_node (cgraph (node));
else
if (verify_symtab_base (node))
{
dump_symtab_node (stderr, node);
internal_error ("verify_symtab_node failed");
}
timevar_pop (TV_CGRAPH_VERIFY);
}
/* Verify symbol table for internal consistency. */
DEBUG_FUNCTION void
verify_symtab (void)
{
symtab_node node;
FOR_EACH_SYMBOL (node)
verify_symtab_node (node);
}
cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c * cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c (cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Move to cgraphunit.c. (cgraph_make_decl_local): Move to symtab.c (cgraph_make_node_local_1): Update. (cgraph_can_remove_if_no_direct_calls_and): Update. (used_from_object_file_p): Update. (resolution_used_from_other_file_p): Move to symtab.c (cgraph_used_from_object_file_p): move to symtab.c (verify_cgraph_node): Verify same comdat groups. * cgraph.h (cgraph_asm_node): Rename to ... (asm_node): ... this one. (cgraph_asm_nodes): Rename to ... (asm_nodes): ... this one. (symtab_add_to_same_comdat_group): New function. (symtab_dissolve_same_comdat_group_list): New function. (symtab_used_from_object_file_p): Declare. (symtab_make_decl_local): Declare. (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Remove. (cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Remove. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one. (cgraph_optimize): Rename to .... (compile): ... this one. (add_asm_node): Declare. (fixup_same_cpp_alias_visibility): Declare. (cgraph_make_decl_local): Remove. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one. (varpool_remove_unreferenced_decls): Remove. * ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups. (preserve_function_body_p): Make static. * toplev.c (compile_file): Update comments; update. * cgraphunit.c: Update comments. (cgraph_expand_all_functions): Rename to ... (expand_all_functions): ... this one; update. (cgraph_mark_functions_to_output): Rename to ... (mark_functions_to_output): ... this one; cleanup. (cgraph_output_pending_asms): Remove prototype. (asm_nodes, asm_last_node): New static vars. (cgraph_process_new_functions): Update. (cgraph_reset_node): Cleanup; add comment. (cgraph_add_new_function): Update. (cgraph_output_pending_asms): Rename to ... (output_asm_statements): ... this one. (add_asm_node): New function. (fixup_same_cpp_alias_visibility): New function based on code in cgraph_analyze_function. (cgraph_analyze_function): Use it. (cgraph_order_sort): Update. (cgraph_output_in_order): Update. (cgraph_function_versioning): Update. (cgraph_optimize): Rename to ... (compile): ... this one; initialize streamer hooks here. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one; do not initialize streamer hook here. * lto-streamer-out.c (lto_output_toplevel_asms): Update. * dwarf2out.c: Update ocmment. * optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group. * method.c (use_thunk): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. * decl2.c (maybe_emit_vtables): Likewise. (cp_write_global_declarations): Use finalize_compilation_unit. * parser.c (cp_parser_asm_definition): Use add_asm_node. * lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node * c-decl.c (c_write_global_declarations): Use finalize_compilation_unit. * langhooks.c (write_global_declarations): Update. * ipa.c (cgraph_externally_visible_p): Update. (dissolve_same_comdat_group_list): Remove. (function_and_variable_visibility): Update. * symtab.c: Inlcude lto-streamer.h and rtl.h (ld_plugin_symbol_resolution_names): New. (symtab_add_to_same_comdat_group): New. (symtab_dissolve_same_comdat_group_list): New. (resolution_used_from_other_file_p): Move here from cgraph.c (symtab_used_from_object_file_p): New. (symtab_make_decl_local): New. * passes.c (register_pass): Update comments. * c-parser.c (c_parser_asm_definition): Update. * varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility. (varpool_remove_unreferenced_decls): Make static. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one; call varpool_remove_unreferenced_decls. (varpool_used_from_object_file_p): Remove. * gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit. * gcc-interface/utils.c (rest_of_subprog_body_compilation): Update comment. (gnat_write_global_declarations): Use finalize_compilation_unit. * f95-lang.c (gfc_finish): Update comments. * lto.c (lto_main): Use compile (). * lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p. (partition_varpool_node_p): Likewise. From-SVN: r186998
2012-04-30 19:55:29 +02:00
/* Return true when RESOLUTION indicate that linker will use
the symbol from non-LTO object files. */
bool
resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution)
{
return (resolution == LDPR_PREVAILING_DEF
|| resolution == LDPR_PREEMPTED_REG
|| resolution == LDPR_RESOLVED_EXEC
|| resolution == LDPR_RESOLVED_DYN);
}
/* Return true when NODE is known to be used from other (non-LTO) object file.
Known only when doing LTO via linker plugin. */
bool
symtab_used_from_object_file_p (symtab_node node)
{
if (!TREE_PUBLIC (node->symbol.decl) || DECL_EXTERNAL (node->symbol.decl))
return false;
if (resolution_used_from_other_file_p (node->symbol.resolution))
return true;
return false;
}
/* Make DECL local. FIXME: We shouldn't need to mess with rtl this early,
but other code such as notice_global_symbol generates rtl. */
void
symtab_make_decl_local (tree decl)
{
rtx rtl, symbol;
if (TREE_CODE (decl) == VAR_DECL)
DECL_COMMON (decl) = 0;
else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
if (DECL_ONE_ONLY (decl) || DECL_COMDAT (decl))
{
/* It is possible that we are linking against library defining same COMDAT
function. To avoid conflict we need to rename our local name of the
function just in the case WHOPR partitioning decide to make it hidden
to avoid cross partition references. */
if (flag_wpa)
{
const char *old_name;
symtab_node node = symtab_get_node (decl);
old_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
change_decl_assembler_name (decl,
clone_function_name (decl, "local"));
if (node->symbol.lto_file_data)
lto_record_renamed_decl (node->symbol.lto_file_data,
old_name,
IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (decl)));
}
DECL_SECTION_NAME (decl) = 0;
DECL_COMDAT (decl) = 0;
}
DECL_COMDAT_GROUP (decl) = 0;
DECL_WEAK (decl) = 0;
DECL_EXTERNAL (decl) = 0;
symtab.c (insert_to_assembler_name_hash): Do not insert register vars. * symtab.c (insert_to_assembler_name_hash): Do not insert register vars. (unlink_from_assembler_name_hash): NULL out pointers of unlinked var. (symtab_prevail_in_asm_name_hash): New. (symtab_initialize_asm_name_hash): Break out from ... (symtab_node_for_asm): ... here. (dump_symtab_base): Dump LTO file data. (verify_symtab_base): Register vars are not in symtab. * cgraph.h (symtab_initialize_asm_name_hash, symtab_prevail_in_asm_name_hash): New functions. (symtab_real_symbol_p): New inline. * lto-symtab.c: Do not include gt-lto-symtab.h. (lto_symtab_entry_def): Remove. (lto_symtab_entry_t): Remove. (lto_symtab_identifiers): Remove. (lto_symtab_free): Remove. (lto_symtab_entry_hash): Remove. (lto_symtab_entry_eq): Remove. (lto_symtab_entry_marked_p): Remove. (lto_symtab_maybe_init_hash_table): Remove. (resolution_guessed_p, set_resolution_guessed): New functions. (lto_symtab_register_decl): Only set resolution info. (lto_symtab_get, lto_symtab_get_resolution): Remove. (lto_symtab_merge): Reorg to work across symtab; do nothing if decls are same. (lto_symtab_resolve_replaceable_p): Reorg to work on symtab. (lto_symtab_resolve_can_prevail_p): Likewise; only real symbols can prevail. (lto_symtab_resolve_symbols): Reorg to work on symtab. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise; add debug dumps. (lto_symtab_merge_decls): Likewise; do not merge at ltrans stage. (lto_symtab_merge_cgraph_nodes_1): Reorg to work on symtab. (lto_symtab_merge_cgraph_nodes): Likewise; do not merge at ltrans stage. (lto_symtab_prevailing_decl): Rewrite to lookup into symtab. * lto-streaer.h (lto_symtab_free): Remove. * lto-cgraph.c (add_references): Cleanup. * varpool.c (varpool_assemble_decl): Skip hard regs. * lto.c (lto_materialize_function): Update confused comment. (read_cgraph_and_symbols): Do not free symtab. From-SVN: r191466
2012-09-19 12:01:56 +02:00
DECL_VISIBILITY_SPECIFIED (decl) = 0;
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c * cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c (cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Move to cgraphunit.c. (cgraph_make_decl_local): Move to symtab.c (cgraph_make_node_local_1): Update. (cgraph_can_remove_if_no_direct_calls_and): Update. (used_from_object_file_p): Update. (resolution_used_from_other_file_p): Move to symtab.c (cgraph_used_from_object_file_p): move to symtab.c (verify_cgraph_node): Verify same comdat groups. * cgraph.h (cgraph_asm_node): Rename to ... (asm_node): ... this one. (cgraph_asm_nodes): Rename to ... (asm_nodes): ... this one. (symtab_add_to_same_comdat_group): New function. (symtab_dissolve_same_comdat_group_list): New function. (symtab_used_from_object_file_p): Declare. (symtab_make_decl_local): Declare. (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Remove. (cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Remove. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one. (cgraph_optimize): Rename to .... (compile): ... this one. (add_asm_node): Declare. (fixup_same_cpp_alias_visibility): Declare. (cgraph_make_decl_local): Remove. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one. (varpool_remove_unreferenced_decls): Remove. * ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups. (preserve_function_body_p): Make static. * toplev.c (compile_file): Update comments; update. * cgraphunit.c: Update comments. (cgraph_expand_all_functions): Rename to ... (expand_all_functions): ... this one; update. (cgraph_mark_functions_to_output): Rename to ... (mark_functions_to_output): ... this one; cleanup. (cgraph_output_pending_asms): Remove prototype. (asm_nodes, asm_last_node): New static vars. (cgraph_process_new_functions): Update. (cgraph_reset_node): Cleanup; add comment. (cgraph_add_new_function): Update. (cgraph_output_pending_asms): Rename to ... (output_asm_statements): ... this one. (add_asm_node): New function. (fixup_same_cpp_alias_visibility): New function based on code in cgraph_analyze_function. (cgraph_analyze_function): Use it. (cgraph_order_sort): Update. (cgraph_output_in_order): Update. (cgraph_function_versioning): Update. (cgraph_optimize): Rename to ... (compile): ... this one; initialize streamer hooks here. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one; do not initialize streamer hook here. * lto-streamer-out.c (lto_output_toplevel_asms): Update. * dwarf2out.c: Update ocmment. * optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group. * method.c (use_thunk): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. * decl2.c (maybe_emit_vtables): Likewise. (cp_write_global_declarations): Use finalize_compilation_unit. * parser.c (cp_parser_asm_definition): Use add_asm_node. * lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node * c-decl.c (c_write_global_declarations): Use finalize_compilation_unit. * langhooks.c (write_global_declarations): Update. * ipa.c (cgraph_externally_visible_p): Update. (dissolve_same_comdat_group_list): Remove. (function_and_variable_visibility): Update. * symtab.c: Inlcude lto-streamer.h and rtl.h (ld_plugin_symbol_resolution_names): New. (symtab_add_to_same_comdat_group): New. (symtab_dissolve_same_comdat_group_list): New. (resolution_used_from_other_file_p): Move here from cgraph.c (symtab_used_from_object_file_p): New. (symtab_make_decl_local): New. * passes.c (register_pass): Update comments. * c-parser.c (c_parser_asm_definition): Update. * varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility. (varpool_remove_unreferenced_decls): Make static. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one; call varpool_remove_unreferenced_decls. (varpool_used_from_object_file_p): Remove. * gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit. * gcc-interface/utils.c (rest_of_subprog_body_compilation): Update comment. (gnat_write_global_declarations): Use finalize_compilation_unit. * f95-lang.c (gfc_finish): Update comments. * lto.c (lto_main): Use compile (). * lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p. (partition_varpool_node_p): Likewise. From-SVN: r186998
2012-04-30 19:55:29 +02:00
TREE_PUBLIC (decl) = 0;
DECL_VISIBILITY_SPECIFIED (decl) = 0;
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c * cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c (cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Move to cgraphunit.c. (cgraph_make_decl_local): Move to symtab.c (cgraph_make_node_local_1): Update. (cgraph_can_remove_if_no_direct_calls_and): Update. (used_from_object_file_p): Update. (resolution_used_from_other_file_p): Move to symtab.c (cgraph_used_from_object_file_p): move to symtab.c (verify_cgraph_node): Verify same comdat groups. * cgraph.h (cgraph_asm_node): Rename to ... (asm_node): ... this one. (cgraph_asm_nodes): Rename to ... (asm_nodes): ... this one. (symtab_add_to_same_comdat_group): New function. (symtab_dissolve_same_comdat_group_list): New function. (symtab_used_from_object_file_p): Declare. (symtab_make_decl_local): Declare. (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Remove. (cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Remove. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one. (cgraph_optimize): Rename to .... (compile): ... this one. (add_asm_node): Declare. (fixup_same_cpp_alias_visibility): Declare. (cgraph_make_decl_local): Remove. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one. (varpool_remove_unreferenced_decls): Remove. * ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups. (preserve_function_body_p): Make static. * toplev.c (compile_file): Update comments; update. * cgraphunit.c: Update comments. (cgraph_expand_all_functions): Rename to ... (expand_all_functions): ... this one; update. (cgraph_mark_functions_to_output): Rename to ... (mark_functions_to_output): ... this one; cleanup. (cgraph_output_pending_asms): Remove prototype. (asm_nodes, asm_last_node): New static vars. (cgraph_process_new_functions): Update. (cgraph_reset_node): Cleanup; add comment. (cgraph_add_new_function): Update. (cgraph_output_pending_asms): Rename to ... (output_asm_statements): ... this one. (add_asm_node): New function. (fixup_same_cpp_alias_visibility): New function based on code in cgraph_analyze_function. (cgraph_analyze_function): Use it. (cgraph_order_sort): Update. (cgraph_output_in_order): Update. (cgraph_function_versioning): Update. (cgraph_optimize): Rename to ... (compile): ... this one; initialize streamer hooks here. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one; do not initialize streamer hook here. * lto-streamer-out.c (lto_output_toplevel_asms): Update. * dwarf2out.c: Update ocmment. * optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group. * method.c (use_thunk): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. * decl2.c (maybe_emit_vtables): Likewise. (cp_write_global_declarations): Use finalize_compilation_unit. * parser.c (cp_parser_asm_definition): Use add_asm_node. * lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node * c-decl.c (c_write_global_declarations): Use finalize_compilation_unit. * langhooks.c (write_global_declarations): Update. * ipa.c (cgraph_externally_visible_p): Update. (dissolve_same_comdat_group_list): Remove. (function_and_variable_visibility): Update. * symtab.c: Inlcude lto-streamer.h and rtl.h (ld_plugin_symbol_resolution_names): New. (symtab_add_to_same_comdat_group): New. (symtab_dissolve_same_comdat_group_list): New. (resolution_used_from_other_file_p): Move here from cgraph.c (symtab_used_from_object_file_p): New. (symtab_make_decl_local): New. * passes.c (register_pass): Update comments. * c-parser.c (c_parser_asm_definition): Update. * varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility. (varpool_remove_unreferenced_decls): Make static. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one; call varpool_remove_unreferenced_decls. (varpool_used_from_object_file_p): Remove. * gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit. * gcc-interface/utils.c (rest_of_subprog_body_compilation): Update comment. (gnat_write_global_declarations): Use finalize_compilation_unit. * f95-lang.c (gfc_finish): Update comments. * lto.c (lto_main): Use compile (). * lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p. (partition_varpool_node_p): Likewise. From-SVN: r186998
2012-04-30 19:55:29 +02:00
if (!DECL_RTL_SET_P (decl))
return;
/* Update rtl flags. */
make_decl_rtl (decl);
rtl = DECL_RTL (decl);
if (!MEM_P (rtl))
return;
symbol = XEXP (rtl, 0);
if (GET_CODE (symbol) != SYMBOL_REF)
return;
SYMBOL_REF_WEAK (symbol) = DECL_WEAK (decl);
}
cgraph.c (cgraph_hash, [...]): Remove. * cgraph.c (cgraph_hash, assembler_name_hash): Remove. (hash_node, eq_node): Remove. (cgraph_create_node): Do not handle hashtable. (cgraph_get_node): Remove. (cgraph_insert_node_to_hashtable): Remove. (hash_node_by_assembler_name): Remove. (eq_assembler_name): Remove. (cgraph_node_for_asm): Rewrite. (cgraph_find_replacement_node): Break out from ... (cgraph_remove_node): ... here; do not maintain hashtables. (change_decl_assembler_name): Remove. (cgraph_clone_node): Do not maintain hashtables. * cgraph.h (const_symtab_node): New typedef. (cgraph_insert_node_to_hashtable): Remove. (symtab_get_node, symtab_node_for_asm, symtab_insert_node_to_hashtable): Declare. (cgraph_find_replacement_node): Declare. (cgraph_get_node, varpool_get_node): Turn into inlines. (cgraph, varpool): Work sanely on NULL pointers. (FOR_EACH_SYMBOL): New walker. * ipa-inline-transform.c (save_inline_function_body): Use symtab_insert_node_to_hashtable. * symtab.c: Include ggc.h and diagnostics.h (symtab_hash, assembler_name_hash): New static vars; (hash_node, eq_node, hash_node_by_assembler_name, eq_assembler_name, insert_to_assembler_name_hash, unlink_from_assembler_name_hash): New. (symtab_register_node): Update hashtables. (symtab_insert_node_to_hashtable): New. (symtab_unregister_node): Update hashtables. (symtab_get_node): New. (symtab_node_for_asm): New. (change_decl_assembler_name): New. * Makefile.in (symtab.o): Needs GTY. * varpool.c (varpool_hash): Remove. (hash_varpool_node, eq_varpool_node, varpool_get_node): Remove. (varpool_node): Rewrite using varpool_get_node. (varpool_remove_node): DO not maintain hashtables. (varpool_node_for_asm); Rewrite. From-SVN: r186525
2012-04-17 12:53:22 +02:00
#include "gt-symtab.h"