aboutsummaryrefslogtreecommitdiff
path: root/gcc/symtab.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2014-08-25 15:01:47 +0200
committerMartin Liska <marxin@gcc.gnu.org>2014-08-25 13:01:47 +0000
commit3dafb85c8e6ade82adc591fe97c116b193f8bb0d (patch)
tree6efa3ef534f8ca5761c35200d5cc61a819dde6f4 /gcc/symtab.c
parent3749134042ab5f54d0c30af1ec336e7132ac9bc8 (diff)
downloadgcc-3dafb85c8e6ade82adc591fe97c116b193f8bb0d.zip
gcc-3dafb85c8e6ade82adc591fe97c116b193f8bb0d.tar.gz
gcc-3dafb85c8e6ade82adc591fe97c116b193f8bb0d.tar.bz2
IPA C++ refactoring 4/N
* cgraph.h (symtab_node): (bool needed_p (void)): created from decide_is_symbol_needed (bool referred_to_p (void)): created from referred_to_p (static cgraph_node *get_for_asmname (tree asmname)): created from symtab_node_for_asm * cgraph.h (cgraph_node): (void assemble_thunks_and_aliases (void)): created from assemble_thunks_and_aliases (void expand (void)): created from expand_function (static void finalize_function (tree, bool)): created from cgraph_finalize_function (static cgraph_local_info *local_info (tree decl)): created from cgraph_local_info (static cgraph_global_info *global_info (tree)): created from cgraph_global_info (static cgraph_rtl_info *rtl_info (tree)): created from cgraph_rtl_info * cgraph.h (varpool_node): (static void add (tree decl): created from varpool_add_new_variable * cgraph.h (cgraph_edge): void remove (void); (void remove_caller (void)): created from cgraph_edge_remove_caller (void remove_callee (void)): created from cgraph_edge_remove_callee (void set_call_stmt (gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt (void redirect_callee (cgraph_node *n)): created from cgraph_redirect_edge_callee (cgraph_edge *make_direct (cgraph_node *callee)): created from cgraph_make_edge_direct (cgraph_edge *make_speculative (cgraph_node *n2, gcov_type direct_count, gimple redirect_call_stmt_to_callee (void)): created from cgraph_turn_edge_to_speculative (void speculative_call_info (cgraph_edge *&direct, cgraph_edge *&indirect, ipa_ref *&reference)): created from cgraph_speculative_call_info (cgraph_edge * clone (cgraph_node *n, gimple call_stmt, unsigned stmt_uid, gcov_type count_scale, int freq_scale, bool update_original)): created from cgraph_clone_edge (cgraph_edge *resolve_speculation (tree callee_decl)): created from cgraph_resolve_speculation (bool cannot_lead_to_return_p (void)): created from cannot_lead_to_return_p (bool recursive_p (void)): created from cgraph_edge_recursive_p (bool maybe_hot_p (void)): created from cgraph_maybe_hot_edge_p (static unsigned int rebuild_edges (void)): created from rebuild_cgraph_edges (static void rebuild_references (void)): created from cgraph_rebuild_references * cgraph.h (symbol_table): (create_reference): renamed from add_reference (maybe_create_reference): renamed from maybe_add_reference (void register_symbol (symtab_node *node)): new function (void clear_asm_symbols (void)): new function (void unregister (symtab_node *node)): new function (void release_symbol (cgraph_node *node, int uid)): new function (cgraph_node * allocate_cgraph_symbol (void)): new function (void initialize (void)): created from cgraph_init (symtab_node *first_symbol (void)):new function (asm_node *first_asm_symbol (void)):new function (symtab_node *first_defined_symbol (void)):new function (varpool_node *first_variable (void)):new function (varpool_node *next_variable (varpool_node *node)):new function (varpool_node *first_static_initializer (void)):new function (varpool_node *next_static_initializer (varpool_node *node)):new function (varpool_node *first_defined_variable (void)):new function (varpool_node *next_defined_variable (varpool_node *node)):new function (cgraph_node *first_defined_function (void)):new function (cgraph_node *next_defined_function (cgraph_node *node)):new function (cgraph_node *first_function (void)):new function (cgraph_node *next_function (cgraph_node *node)):new function (cgraph_node *first_function_with_gimple_body (void)):new function (asm_node *finalize_toplevel_asm (tree asm_str)): created from add_asm_node (bool remove_unreachable_nodes (bool before_inlining_p, FILE *file)): created from symtab_remove_unreachable_nodes (void remove_unreferenced_decls (void)): created from varpool_remove_unreferenced_decls (void process_new_functions (void)): created from cgraph_process_new_functions (void process_same_body_aliases (void)): created from cgraph_process_same_body_aliases (bool output_variables (void)): created from varpool_node::output_variables (void output_asm_statements (void)): created from output_asm_statements (void finalize_compilation_unit (void)): created from finalize_compilation_unit (void compile (void)): created from compile (void output_weakrefs (void)): created from output_weakrefs (cgraph_node *create_empty (void)): created from cgraph_node::create_empty (cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_node::create_edge (void free_edge (cgraph_edge *e)): created from cgraph_free_edge (cgraph_node *next_function_with_gimple_body (cgraph_node *node)): created from cgraph_next_function_with_gimple_body (void remove_edge_removal_hook (cgraph_edge_hook_list *)): created from cgraph_remove_edge_removal_hook (cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook, void *)): created from cgraph_add_node_removal_hook (void remove_cgraph_removal_hook (cgraph_node_hook_list *)): created from cgraph_remove_node_removal_hook (varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook, void *)): created from varpool_add_node_removal_hook (void remove_varpool_removal_hook (varpool_node_hook_list *)): created from varpool_remove_node_removal_hook (cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook, void *)): created from cgraph_add_function_insertion_hook (void remove_cgraph_insertion_hook (cgraph_node_hook_list *)): created from cgraph_remove_function_insertion_hook (varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook, void *)): created from varpool_add_variable_insertion_hook (void remove_varpool_insertion_hook (varpool_node_hook_list *)): created from varpool_remove_variable_insertion_hook (cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook, void *)): created from cgraph_add_edge_duplication_hook (void remove_edge_duplication_hook (cgraph_2edge_hook_list *)): created from cgraph_remove_edge_duplication_hook (cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook, void *)): created from cgraph_add_node_duplication_hook (void remove_cgraph_duplication_hook (cgraph_2node_hook_list *)): created from cgraph_remove_node_duplication_hook (void call_edge_removal_hooks (cgraph_edge *e)): created from cgraph_call_edge_removal_hooks (void call_cgraph_insertion_hooks (cgraph_node *node)): created from call_function_insertion_hooks (void call_cgraph_removal_hooks (cgraph_node *node)): created from cgraph_call_node_removal_hooks (void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2)): created from cgraph_node::call_duplication_hooks (void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2)): created from cgraph_call_edge_duplication_hooks (void call_varpool_removal_hooks (varpool_node *node)): created from varpool_call_node_removal_hooks (void call_varpool_insertion_hooks (varpool_node *node)): created from varpool_call_variable_insertion_hooks (void insert_to_assembler_name_hash (symtab_node *node, bool with_clones)): created from insert_to_assembler_name_hash (void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones)): created from unlink_from_assembler_name_hash (void symtab_prevail_in_asm_name_hash (symtab_node *node)): created from symtab_prevail_in_asm_name_hash (void symtab_initialize_asm_name_hash (void)): created from symtab_initialize_asm_name_hash (void change_decl_assembler_name (tree decl, tree name)): created from change_decl_assembler_name (void materialize_all_clones (void)): created from cgraph_materialize_all_clones (static hashval_t decl_assembler_name_hash (const_tree asmname)): created from decl_assembler_name_hash (static bool decl_assembler_name_equal (tree decl, const_tree asmname)): created from decl_assembler_name_equal (static hashval_t hash_node_by_assembler_name (const void *p)): created from hash_node_by_assembler_name (static int eq_assembler_name (const void *p1, const void *p2)): created from eq_assembler_name From-SVN: r214422
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r--gcc/symtab.c274
1 files changed, 120 insertions, 154 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c
index a93c299..739a8e4 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -61,36 +61,10 @@ const char * const ld_plugin_symbol_resolution_names[]=
"prevailing_def_ironly_exp"
};
-
-/* Hash table used to hold sectoons. */
-static GTY((param_is (section_hash_entry))) htab_t section_hash;
-
-/* Hash table used to convert assembler names into nodes. */
-static GTY((param_is (symtab_node))) htab_t assembler_name_hash;
-
-/* Map from a symbol to initialization/finalization priorities. */
-struct GTY(()) symbol_priority_map {
- symtab_node *symbol;
- priority_type init;
- priority_type fini;
-};
-
-/* Hash table used to hold init priorities. */
-static GTY ((param_is (struct symbol_priority_map)))
- htab_t init_priority_hash;
-
-/* 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;
-
/* Hash asmnames ignoring the user specified marks. */
-static hashval_t
-decl_assembler_name_hash (const_tree asmname)
+hashval_t
+symbol_table::decl_assembler_name_hash (const_tree asmname)
{
if (IDENTIFIER_POINTER (asmname)[0] == '*')
{
@@ -111,8 +85,8 @@ decl_assembler_name_hash (const_tree asmname)
/* Returns a hash code for P. */
-static hashval_t
-hash_node_by_assembler_name (const void *p)
+hashval_t
+symbol_table::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->decl));
@@ -120,8 +94,8 @@ hash_node_by_assembler_name (const void *p)
/* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */
-static bool
-decl_assembler_name_equal (tree decl, const_tree asmname)
+bool
+symbol_table::decl_assembler_name_equal (tree decl, const_tree asmname)
{
tree decl_asmname = DECL_ASSEMBLER_NAME (decl);
const char *decl_str;
@@ -176,8 +150,8 @@ decl_assembler_name_equal (tree decl, const_tree asmname)
/* Returns nonzero if P1 and P2 are equal. */
-static int
-eq_assembler_name (const void *p1, const void *p2)
+int
+symbol_table::eq_assembler_name (const void *p1, const void *p2)
{
const symtab_node *n1 = (const symtab_node *) p1;
const_tree name = (const_tree)p2;
@@ -186,8 +160,9 @@ eq_assembler_name (const void *p1, const void *p2)
/* Insert NODE to assembler name hash. */
-static void
-insert_to_assembler_name_hash (symtab_node *node, bool with_clones)
+void
+symbol_table::insert_to_assembler_name_hash (symtab_node *node,
+ bool with_clones)
{
if (is_a <varpool_node *> (node) && DECL_HARD_REGISTER (node->decl))
return;
@@ -196,7 +171,7 @@ insert_to_assembler_name_hash (symtab_node *node, bool with_clones)
if (assembler_name_hash)
{
void **aslot;
- struct cgraph_node *cnode;
+ cgraph_node *cnode;
tree decl = node->decl;
tree name = DECL_ASSEMBLER_NAME (node->decl);
@@ -222,12 +197,13 @@ insert_to_assembler_name_hash (symtab_node *node, bool with_clones)
/* Remove NODE from assembler name hash. */
-static void
-unlink_from_assembler_name_hash (symtab_node *node, bool with_clones)
+void
+symbol_table::unlink_from_assembler_name_hash (symtab_node *node,
+ bool with_clones)
{
if (assembler_name_hash)
{
- struct cgraph_node *cnode;
+ cgraph_node *cnode;
tree decl = node->decl;
if (node->next_sharing_asm_name)
@@ -266,7 +242,7 @@ unlink_from_assembler_name_hash (symtab_node *node, bool with_clones)
/* Arrange node to be first in its entry of assembler_name_hash. */
void
-symtab_prevail_in_asm_name_hash (symtab_node *node)
+symbol_table::symtab_prevail_in_asm_name_hash (symtab_node *node)
{
unlink_from_assembler_name_hash (node, false);
insert_to_assembler_name_hash (node, false);
@@ -275,7 +251,7 @@ symtab_prevail_in_asm_name_hash (symtab_node *node)
/* Initalize asm name hash unless. */
void
-symtab_initialize_asm_name_hash (void)
+symbol_table::symtab_initialize_asm_name_hash (void)
{
symtab_node *node;
if (!assembler_name_hash)
@@ -288,32 +264,10 @@ symtab_initialize_asm_name_hash (void)
}
}
-/* 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 ();
- 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)
+symbol_table::change_decl_assembler_name (tree decl, tree name)
{
symtab_node *node = NULL;
@@ -391,22 +345,16 @@ eq_sections (const void *p1, const void *p2)
void
symtab_node::register_symbol (void)
{
- next = symtab_nodes;
- previous = NULL;
- if (symtab_nodes)
- symtab_nodes->previous = this;
- symtab_nodes = this;
+ symtab->register_symbol (this);
if (!decl->decl_with_vis.symtab_node)
decl->decl_with_vis.symtab_node = this;
ref_list.clear ();
- 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 (this, false);
+ symtab->insert_to_assembler_name_hash (this, false);
}
/* Remove NODE from same comdat group. */
@@ -444,14 +392,7 @@ symtab_node::unregister (void)
remove_from_same_comdat_group ();
- if (previous)
- previous->next = next;
- else
- symtab_nodes = next;
- if (next)
- next->previous = previous;
- next = NULL;
- previous = NULL;
+ symtab->unregister (this);
/* During LTO symtab merging we temporarily corrupt decl to symtab node
hash. */
@@ -464,16 +405,16 @@ symtab_node::unregister (void)
decl->decl_with_vis.symtab_node = replacement_node;
}
if (!is_a <varpool_node *> (this) || !DECL_HARD_REGISTER (decl))
- unlink_from_assembler_name_hash (this, false);
+ symtab->unlink_from_assembler_name_hash (this, false);
if (in_init_priority_hash)
{
- struct symbol_priority_map in;
+ symbol_priority_map in;
void **slot;
in.symbol = this;
- slot = htab_find_slot (init_priority_hash, &in, NO_INSERT);
+ slot = htab_find_slot (symtab->init_priority_hash, &in, NO_INSERT);
if (slot)
- htab_clear_slot (init_priority_hash, slot);
+ htab_clear_slot (symtab->init_priority_hash, slot);
}
}
@@ -560,11 +501,11 @@ symtab_node::name () const
REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type
of the use. */
-struct ipa_ref *
-symtab_node::add_reference (symtab_node *referred_node,
- enum ipa_ref_use use_type)
+ipa_ref *
+symtab_node::create_reference (symtab_node *referred_node,
+ enum ipa_ref_use use_type)
{
- return add_reference (referred_node, use_type, NULL);
+ return create_reference (referred_node, use_type, NULL);
}
@@ -572,12 +513,12 @@ symtab_node::add_reference (symtab_node *referred_node,
REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type
of the use and STMT the statement (if it exists). */
-struct ipa_ref *
-symtab_node::add_reference (symtab_node *referred_node,
- enum ipa_ref_use use_type, gimple stmt)
+ipa_ref *
+symtab_node::create_reference (symtab_node *referred_node,
+ enum ipa_ref_use use_type, gimple stmt)
{
- struct ipa_ref *ref = NULL, *ref2 = NULL;
- struct ipa_ref_list *list, *list2;
+ ipa_ref *ref = NULL, *ref2 = NULL;
+ ipa_ref_list *list, *list2;
ipa_ref_t *old_references;
gcc_checking_assert (!stmt || is_a <cgraph_node *> (this));
@@ -627,9 +568,9 @@ symtab_node::add_reference (symtab_node *referred_node,
type of the use and STMT the statement (if it exists). Return the new
reference or NULL if none was created. */
-struct ipa_ref *
-symtab_node::maybe_add_reference (tree val, enum ipa_ref_use use_type,
- gimple stmt)
+ipa_ref *
+symtab_node::maybe_create_reference (tree val, enum ipa_ref_use use_type,
+ gimple stmt)
{
STRIP_NOPS (val);
if (TREE_CODE (val) != ADDR_EXPR)
@@ -640,7 +581,7 @@ symtab_node::maybe_add_reference (tree val, enum ipa_ref_use use_type,
{
symtab_node *referred = symtab_node::get (val);
gcc_checking_assert (referred);
- return add_reference (referred, use_type, stmt);
+ return create_reference (referred, use_type, stmt);
}
return NULL;
}
@@ -648,16 +589,16 @@ symtab_node::maybe_add_reference (tree val, enum ipa_ref_use use_type,
/* Clone all references from symtab NODE to this symtab_node. */
void
-symtab_node::clone_references (struct symtab_node *node)
+symtab_node::clone_references (symtab_node *node)
{
- struct ipa_ref *ref = NULL, *ref2 = NULL;
+ ipa_ref *ref = NULL, *ref2 = NULL;
int i;
for (i = 0; node->iterate_reference (i, ref); i++)
{
bool speculative = ref->speculative;
unsigned int stmt_uid = ref->lto_stmt_uid;
- ref2 = add_reference (ref->referred, ref->use, ref->stmt);
+ ref2 = create_reference (ref->referred, ref->use, ref->stmt);
ref2->speculative = speculative;
ref2->lto_stmt_uid = stmt_uid;
}
@@ -666,16 +607,16 @@ symtab_node::clone_references (struct symtab_node *node)
/* Clone all referring from symtab NODE to this symtab_node. */
void
-symtab_node::clone_referring (struct symtab_node *node)
+symtab_node::clone_referring (symtab_node *node)
{
- struct ipa_ref *ref = NULL, *ref2 = NULL;
+ ipa_ref *ref = NULL, *ref2 = NULL;
int i;
for (i = 0; node->iterate_referring(i, ref); i++)
{
bool speculative = ref->speculative;
unsigned int stmt_uid = ref->lto_stmt_uid;
- ref2 = ref->referring->add_reference (this, ref->use, ref->stmt);
+ ref2 = ref->referring->create_reference (this, ref->use, ref->stmt);
ref2->speculative = speculative;
ref2->lto_stmt_uid = stmt_uid;
}
@@ -683,14 +624,14 @@ symtab_node::clone_referring (struct symtab_node *node)
/* Clone reference REF to this symtab_node and set its stmt to STMT. */
-struct ipa_ref *
-symtab_node::clone_reference (struct ipa_ref *ref, gimple stmt)
+ipa_ref *
+symtab_node::clone_reference (ipa_ref *ref, gimple stmt)
{
bool speculative = ref->speculative;
unsigned int stmt_uid = ref->lto_stmt_uid;
- struct ipa_ref *ref2;
+ ipa_ref *ref2;
- ref2 = add_reference (ref->referred, ref->use, stmt);
+ ref2 = create_reference (ref->referred, ref->use, stmt);
ref2->speculative = speculative;
ref2->lto_stmt_uid = stmt_uid;
return ref2;
@@ -699,11 +640,11 @@ symtab_node::clone_reference (struct ipa_ref *ref, gimple stmt)
/* Find the structure describing a reference to REFERRED_NODE
and associated with statement STMT. */
-struct ipa_ref *
+ipa_ref *
symtab_node::find_reference (symtab_node *referred_node,
gimple stmt, unsigned int lto_stmt_uid)
{
- struct ipa_ref *r = NULL;
+ ipa_ref *r = NULL;
int i;
for (i = 0; iterate_reference (i, r); i++)
@@ -721,7 +662,7 @@ symtab_node::find_reference (symtab_node *referred_node,
void
symtab_node::remove_stmt_references (gimple stmt)
{
- struct ipa_ref *r = NULL;
+ ipa_ref *r = NULL;
int i = 0;
while (iterate_reference (i, r))
@@ -739,7 +680,7 @@ symtab_node::remove_stmt_references (gimple stmt)
void
symtab_node::clear_stmts_in_references (void)
{
- struct ipa_ref *r = NULL;
+ ipa_ref *r = NULL;
int i;
for (i = 0; iterate_reference (i, r); i++)
@@ -775,7 +716,7 @@ symtab_node::remove_all_referring (void)
void
symtab_node::dump_references (FILE *file)
{
- struct ipa_ref *ref = NULL;
+ ipa_ref *ref = NULL;
int i;
for (i = 0; iterate_reference (i, ref); i++)
{
@@ -794,7 +735,7 @@ symtab_node::dump_references (FILE *file)
void
symtab_node::dump_referring (FILE *file)
{
- struct ipa_ref *ref = NULL;
+ ipa_ref *ref = NULL;
int i;
for (i = 0; iterate_referring(i, ref); i++)
{
@@ -812,7 +753,7 @@ symtab_node::dump_referring (FILE *file)
bool
symtab_node::has_aliases_p (void)
{
- struct ipa_ref *ref = NULL;
+ ipa_ref *ref = NULL;
int i;
for (i = 0; iterate_referring (i, ref); i++)
@@ -823,8 +764,8 @@ symtab_node::has_aliases_p (void)
/* Iterates I-th reference in the list, REF is also set. */
-struct ipa_ref *
-symtab_node::iterate_reference (unsigned i, struct ipa_ref *&ref)
+ipa_ref *
+symtab_node::iterate_reference (unsigned i, ipa_ref *&ref)
{
vec_safe_iterate (ref_list.references, i, &ref);
@@ -833,8 +774,8 @@ symtab_node::iterate_reference (unsigned i, struct ipa_ref *&ref)
/* Iterates I-th referring item in the list, REF is also set. */
-struct ipa_ref *
-symtab_node::iterate_referring (unsigned i, struct ipa_ref *&ref)
+ipa_ref *
+symtab_node::iterate_referring (unsigned i, ipa_ref *&ref)
{
ref_list.referring.iterate (i, &ref);
@@ -843,8 +784,8 @@ symtab_node::iterate_referring (unsigned i, struct ipa_ref *&ref)
/* Iterates I-th referring alias item in the list, REF is also set. */
-struct ipa_ref *
-symtab_node::iterate_direct_aliases (unsigned i, struct ipa_ref *&ref)
+ipa_ref *
+symtab_node::iterate_direct_aliases (unsigned i, ipa_ref *&ref)
{
ref_list.referring.iterate (i, &ref);
@@ -993,6 +934,29 @@ symtab_node::dump_table (FILE *f)
node->dump (f);
}
+
+/* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
+ Return NULL if there's no such node. */
+
+symtab_node *
+symtab_node::get_for_asmname (const_tree asmname)
+{
+ symtab_node *node;
+ void **slot;
+
+ symtab->symtab_initialize_asm_name_hash ();
+ slot = htab_find_slot_with_hash (symtab->assembler_name_hash, asmname,
+ symtab->decl_assembler_name_hash (asmname),
+ NO_INSERT);
+
+ if (slot)
+ {
+ node = (symtab_node *) *slot;
+ return node;
+ }
+ return NULL;
+}
+
/* Dump symtab node NODE to stderr. */
DEBUG_FUNCTION void
@@ -1031,7 +995,7 @@ symtab_node::verify_base (void)
error_found = true;
}
- if (cgraph_state != CGRAPH_LTO_STREAMING)
+ if (symtab->state != LTO_STREAMING)
{
hashed_node = symtab_node::get (decl);
if (!hashed_node)
@@ -1048,9 +1012,9 @@ symtab_node::verify_base (void)
error_found = true;
}
}
- if (assembler_name_hash)
+ if (symtab->assembler_name_hash)
{
- hashed_node = symtab_node_for_asm (DECL_ASSEMBLER_NAME (decl));
+ hashed_node = symtab_node::get_for_asmname (DECL_ASSEMBLER_NAME (decl));
if (hashed_node && hashed_node->previous_sharing_asm_name)
{
error ("assembler name hash list corrupted");
@@ -1138,7 +1102,7 @@ symtab_node::verify_base (void)
while (n != this);
if (comdat_local_p ())
{
- struct ipa_ref *ref = NULL;
+ ipa_ref *ref = NULL;
for (int i = 0; iterate_referring (i, ref); ++i)
{
@@ -1436,11 +1400,11 @@ symtab_node::set_section_for_node (const char *section)
x_section->ref_count--;
if (!x_section->ref_count)
{
- slot = htab_find_slot_with_hash (section_hash, x_section->name,
+ slot = htab_find_slot_with_hash (symtab->section_hash, x_section->name,
htab_hash_string (x_section->name),
INSERT);
ggc_free (x_section);
- htab_clear_slot (section_hash, slot);
+ htab_clear_slot (symtab->section_hash, slot);
}
x_section = NULL;
}
@@ -1449,10 +1413,10 @@ symtab_node::set_section_for_node (const char *section)
implicit_section = false;
return;
}
- if (!section_hash)
- section_hash = htab_create_ggc (10, hash_section_hash_entry,
+ if (!symtab->section_hash)
+ symtab->section_hash = htab_create_ggc (10, hash_section_hash_entry,
eq_sections, NULL);
- slot = htab_find_slot_with_hash (section_hash, section,
+ slot = htab_find_slot_with_hash (symtab->section_hash, section,
htab_hash_string (section),
INSERT);
if (*slot)
@@ -1491,13 +1455,14 @@ symtab_node::set_section (const char *section)
priority_type
symtab_node::get_init_priority ()
{
- struct symbol_priority_map *h;
- struct symbol_priority_map in;
+ symbol_priority_map *h;
+ symbol_priority_map in;
if (!this->in_init_priority_hash)
return DEFAULT_INIT_PRIORITY;
in.symbol = this;
- h = (struct symbol_priority_map *) htab_find (init_priority_hash, &in);
+ h = (symbol_priority_map *) htab_find (symtab->init_priority_hash,
+ &in);
return h ? h->init : DEFAULT_INIT_PRIORITY;
}
@@ -1516,13 +1481,14 @@ enum availability symtab_node::get_availability (void)
priority_type
cgraph_node::get_fini_priority ()
{
- struct symbol_priority_map *h;
- struct symbol_priority_map in;
+ symbol_priority_map *h;
+ symbol_priority_map in;
if (!this->in_init_priority_hash)
return DEFAULT_INIT_PRIORITY;
in.symbol = this;
- h = (struct symbol_priority_map *) htab_find (init_priority_hash, &in);
+ h = (symbol_priority_map *) htab_find (symtab->init_priority_hash,
+ &in);
return h ? h->fini : DEFAULT_INIT_PRIORITY;
}
@@ -1531,8 +1497,8 @@ cgraph_node::get_fini_priority ()
int
symbol_priority_map_eq (const void *va, const void *vb)
{
- const struct symbol_priority_map *const a = (const struct symbol_priority_map *) va,
- *const b = (const struct symbol_priority_map *) vb;
+ const symbol_priority_map *const a = (const symbol_priority_map *) va,
+ *const b = (const symbol_priority_map *) vb;
return (a->symbol == b->symbol);
}
@@ -1541,27 +1507,28 @@ symbol_priority_map_eq (const void *va, const void *vb)
unsigned int
symbol_priority_map_hash (const void *item)
{
- return htab_hash_pointer (((const struct symbol_priority_map *)item)->symbol);
+ return htab_hash_pointer (((const symbol_priority_map *)item)->symbol);
}
/* Return the initialization and finalization priority information for
DECL. If there is no previous priority information, a freshly
allocated structure is returned. */
-struct symbol_priority_map *
+symbol_priority_map *
symtab_node::priority_info (void)
{
- struct symbol_priority_map in;
- struct symbol_priority_map *h;
+ symbol_priority_map in;
+ symbol_priority_map *h;
void **loc;
in.symbol = this;
- if (!init_priority_hash)
- init_priority_hash = htab_create_ggc (512, symbol_priority_map_hash,
- symbol_priority_map_eq, 0);
+ if (!symtab->init_priority_hash)
+ symtab->init_priority_hash = htab_create_ggc (512,
+ symbol_priority_map_hash,
+ symbol_priority_map_eq, 0);
- loc = htab_find_slot (init_priority_hash, &in, INSERT);
- h = (struct symbol_priority_map *) *loc;
+ loc = htab_find_slot (symtab->init_priority_hash, &in, INSERT);
+ h = (symbol_priority_map *) *loc;
if (!h)
{
h = ggc_cleared_alloc<symbol_priority_map> ();
@@ -1580,7 +1547,7 @@ symtab_node::priority_info (void)
void
symtab_node::set_init_priority (priority_type priority)
{
- struct symbol_priority_map *h;
+ symbol_priority_map *h;
if (is_a <cgraph_node *> (this))
gcc_assert (DECL_STATIC_CONSTRUCTOR (this->decl));
@@ -1599,7 +1566,7 @@ symtab_node::set_init_priority (priority_type priority)
void
cgraph_node::set_fini_priority (priority_type priority)
{
- struct symbol_priority_map *h;
+ symbol_priority_map *h;
gcc_assert (DECL_STATIC_DESTRUCTOR (this->decl));
@@ -1653,7 +1620,7 @@ symtab_node::resolve_alias (symtab_node *target)
definition = true;
alias = true;
analyzed = true;
- add_reference (target, IPA_REF_ALIAS, NULL);
+ create_reference (target, IPA_REF_ALIAS, NULL);
/* Add alias into the comdat group of its target unless it is already there. */
if (same_comdat_group)
@@ -1677,7 +1644,7 @@ symtab_node::resolve_alias (symtab_node *target)
when renaming symbols. */
alias_target = NULL;
- if (cpp_implicit_alias && cgraph_state >= CGRAPH_STATE_CONSTRUCTION)
+ if (cpp_implicit_alias && symtab->state >= CONSTRUCTION)
fixup_same_cpp_alias_visibility (target);
/* If alias has address taken, so does the target. */
@@ -1696,7 +1663,7 @@ symtab_node::call_for_symbol_and_aliases (bool (*callback) (symtab_node *,
void *data, bool include_overwritable)
{
int i;
- struct ipa_ref *ref;
+ ipa_ref *ref;
if (callback (this, data))
return true;
@@ -1926,7 +1893,7 @@ symtab_node::nonzero_address ()
When parsing, beware the cases when WEAK attribute is added later. */
if (!DECL_WEAK (this->decl)
&& flag_delete_null_pointer_checks
- && cgraph_state > CGRAPH_STATE_PARSING)
+ && symtab->state > PARSING)
return true;
/* If target is defined and not extern, we know it will be output and thus
@@ -1944,4 +1911,3 @@ symtab_node::nonzero_address ()
return true;
return false;
}
-#include "gt-symtab.h"