Commit b5493fb2 by Jan Hubicka Committed by Jan Hubicka

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
parent 9745abfd
2012-09-19 Jan Hubicka <jh@suse.cz>
* 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.
2012-09-19 Richard Guenther <rguenther@suse.de> 2012-09-19 Richard Guenther <rguenther@suse.de>
PR other/53316 PR other/53316
......
...@@ -704,6 +704,8 @@ bool varpool_for_node_and_aliases (struct varpool_node *, ...@@ -704,6 +704,8 @@ bool varpool_for_node_and_aliases (struct varpool_node *,
bool (*) (struct varpool_node *, void *), bool (*) (struct varpool_node *, void *),
void *, bool); void *, bool);
void varpool_add_new_variable (tree); void varpool_add_new_variable (tree);
void symtab_initialize_asm_name_hash (void);
void symtab_prevail_in_asm_name_hash (symtab_node node);
/* Return true when NODE is function. */ /* Return true when NODE is function. */
static inline bool static inline bool
...@@ -1309,4 +1311,27 @@ cgraph_mark_force_output_node (struct cgraph_node *node) ...@@ -1309,4 +1311,27 @@ cgraph_mark_force_output_node (struct cgraph_node *node)
gcc_checking_assert (!node->global.inlined_to); gcc_checking_assert (!node->global.inlined_to);
} }
/* Return true when the symbol is real symbol, i.e. it is not inline clone
or extern function kept around just for inlining. */
static inline bool
symtab_real_symbol_p (symtab_node node)
{
struct cgraph_node *cnode;
struct ipa_ref *ref;
if (!symtab_function_p (node))
return true;
cnode = cgraph (node);
if (cnode->global.inlined_to)
return false;
if (cnode->abstract_and_needed)
return false;
/* We keep virtual clones in symtab. */
if (!cnode->analyzed
|| DECL_EXTERNAL (cnode->symbol.decl))
return (cnode->callers
|| ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
return true;
}
#endif /* GCC_CGRAPH_H */ #endif /* GCC_CGRAPH_H */
...@@ -668,10 +668,7 @@ add_references (lto_symtab_encoder_t encoder, ...@@ -668,10 +668,7 @@ add_references (lto_symtab_encoder_t encoder,
if (symtab_function_p (ref->referred)) if (symtab_function_p (ref->referred))
add_node_to (encoder, ipa_ref_node (ref), false); add_node_to (encoder, ipa_ref_node (ref), false);
else else
{ lto_symtab_encoder_encode (encoder, ref->referred);
struct varpool_node *vnode = ipa_ref_varpool_node (ref);
lto_symtab_encoder_encode (encoder, (symtab_node)vnode);
}
} }
/* Find all symbols we want to stream into given partition and insert them /* Find all symbols we want to stream into given partition and insert them
......
...@@ -866,7 +866,6 @@ extern void lto_symtab_merge_decls (void); ...@@ -866,7 +866,6 @@ extern void lto_symtab_merge_decls (void);
extern void lto_symtab_merge_cgraph_nodes (void); extern void lto_symtab_merge_cgraph_nodes (void);
extern tree lto_symtab_prevailing_decl (tree decl); extern tree lto_symtab_prevailing_decl (tree decl);
extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl); extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl);
extern void lto_symtab_free (void);
extern GTY(()) VEC(tree,gc) *lto_global_var_decls; extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
......
2012-09-19 Jan Hubicka <jh@suse.cz>
* lto.c (lto_materialize_function): Update confused comment.
(read_cgraph_and_symbols): Do not free symtab.
2012-09-12 Jan Hubicka <jh@suse.cz> 2012-09-12 Jan Hubicka <jh@suse.cz>
* lto.c (do_whole_program_analysis): Care timevars, statistics and * lto.c (do_whole_program_analysis): Care timevars, statistics and
......
...@@ -198,7 +198,7 @@ lto_materialize_function (struct cgraph_node *node) ...@@ -198,7 +198,7 @@ lto_materialize_function (struct cgraph_node *node)
and also functions that are needed to produce virtual clones. */ and also functions that are needed to produce virtual clones. */
if (cgraph_function_with_gimple_body_p (node) || has_analyzed_clone_p (node)) if (cgraph_function_with_gimple_body_p (node) || has_analyzed_clone_p (node))
{ {
/* Clones and thunks don't need to be read. */ /* Clones don't need to be read. */
if (node->clone_of) if (node->clone_of)
return; return;
...@@ -3006,7 +3006,6 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -3006,7 +3006,6 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
VEC_safe_push (ipa_opt_pass, heap, VEC_safe_push (ipa_opt_pass, heap,
node->ipa_transforms_to_apply, node->ipa_transforms_to_apply,
(ipa_opt_pass)&pass_ipa_inline); (ipa_opt_pass)&pass_ipa_inline);
lto_symtab_free ();
timevar_pop (TV_IPA_LTO_CGRAPH_MERGE); timevar_pop (TV_IPA_LTO_CGRAPH_MERGE);
...@@ -3035,7 +3034,6 @@ materialize_cgraph (void) ...@@ -3035,7 +3034,6 @@ materialize_cgraph (void)
fprintf (stderr, fprintf (stderr,
flag_wpa ? "Materializing decls:" : "Reading function bodies:"); flag_wpa ? "Materializing decls:" : "Reading function bodies:");
/* Now that we have input the cgraph, we need to clear all of the aux /* Now that we have input the cgraph, we need to clear all of the aux
nodes and read the functions if we are not running in WPA mode. */ nodes and read the functions if we are not running in WPA mode. */
timevar_push (TV_IPA_LTO_GIMPLE_IN); timevar_push (TV_IPA_LTO_GIMPLE_IN);
......
...@@ -104,6 +104,8 @@ eq_assembler_name (const void *p1, const void *p2) ...@@ -104,6 +104,8 @@ eq_assembler_name (const void *p1, const void *p2)
static void static void
insert_to_assembler_name_hash (symtab_node node) insert_to_assembler_name_hash (symtab_node node)
{ {
if (symtab_variable_p (node) && DECL_HARD_REGISTER (node->symbol.decl))
return;
gcc_checking_assert (!node->symbol.previous_sharing_asm_name gcc_checking_assert (!node->symbol.previous_sharing_asm_name
&& !node->symbol.next_sharing_asm_name); && !node->symbol.next_sharing_asm_name);
if (assembler_name_hash) if (assembler_name_hash)
...@@ -151,9 +153,20 @@ unlink_from_assembler_name_hash (symtab_node node) ...@@ -151,9 +153,20 @@ unlink_from_assembler_name_hash (symtab_node node)
else else
*slot = node->symbol.next_sharing_asm_name; *slot = node->symbol.next_sharing_asm_name;
} }
node->symbol.next_sharing_asm_name = NULL;
node->symbol.previous_sharing_asm_name = NULL;
} }
} }
/* 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);
}
/* Add node into symbol table. This function is not used directly, but via /* Add node into symbol table. This function is not used directly, but via
cgraph/varpool node creation routines. */ cgraph/varpool node creation routines. */
...@@ -287,15 +300,12 @@ symtab_remove_node (symtab_node node) ...@@ -287,15 +300,12 @@ symtab_remove_node (symtab_node node)
varpool_remove_node (varpool (node)); varpool_remove_node (varpool (node));
} }
/* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME. /* Initalize asm name hash unless. */
Return NULL if there's no such node. */
symtab_node void
symtab_node_for_asm (const_tree asmname) symtab_initialize_asm_name_hash (void)
{ {
symtab_node node; symtab_node node;
void **slot;
if (!assembler_name_hash) if (!assembler_name_hash)
{ {
assembler_name_hash = assembler_name_hash =
...@@ -304,7 +314,18 @@ symtab_node_for_asm (const_tree asmname) ...@@ -304,7 +314,18 @@ symtab_node_for_asm (const_tree asmname)
FOR_EACH_SYMBOL (node) FOR_EACH_SYMBOL (node)
insert_to_assembler_name_hash (node); insert_to_assembler_name_hash (node);
} }
}
/* 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, slot = htab_find_slot_with_hash (assembler_name_hash, asmname,
decl_assembler_name_hash (asmname), decl_assembler_name_hash (asmname),
NO_INSERT); NO_INSERT);
...@@ -507,6 +528,9 @@ dump_symtab_base (FILE *f, symtab_node node) ...@@ -507,6 +528,9 @@ dump_symtab_base (FILE *f, symtab_node node)
ipa_dump_references (f, &node->symbol.ref_list); ipa_dump_references (f, &node->symbol.ref_list);
fprintf (f, " Referring: "); fprintf (f, " Referring: ");
ipa_dump_referring (f, &node->symbol.ref_list); ipa_dump_referring (f, &node->symbol.ref_list);
if (node->symbol.lto_file_data)
fprintf (f, " Read from file: %s\n",
node->symbol.lto_file_data->file_name);
} }
/* Dump symtab node. */ /* Dump symtab node. */
...@@ -597,7 +621,8 @@ verify_symtab_base (symtab_node node) ...@@ -597,7 +621,8 @@ verify_symtab_base (symtab_node node)
break; break;
hashed_node = hashed_node->symbol.next_sharing_asm_name; hashed_node = hashed_node->symbol.next_sharing_asm_name;
} }
if (!hashed_node) if (!hashed_node
&& !(symtab_variable_p (node) || DECL_HARD_REGISTER (node->symbol.decl)))
{ {
error ("node not found in symtab assembler name hash"); error ("node not found in symtab assembler name hash");
error_found = true; error_found = true;
...@@ -733,6 +758,8 @@ symtab_make_decl_local (tree decl) ...@@ -733,6 +758,8 @@ symtab_make_decl_local (tree decl)
DECL_COMDAT_GROUP (decl) = 0; DECL_COMDAT_GROUP (decl) = 0;
DECL_WEAK (decl) = 0; DECL_WEAK (decl) = 0;
DECL_EXTERNAL (decl) = 0; DECL_EXTERNAL (decl) = 0;
DECL_VISIBILITY_SPECIFIED (decl) = 0;
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
TREE_PUBLIC (decl) = 0; TREE_PUBLIC (decl) = 0;
DECL_VISIBILITY_SPECIFIED (decl) = 0; DECL_VISIBILITY_SPECIFIED (decl) = 0;
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
......
...@@ -301,6 +301,10 @@ varpool_assemble_decl (struct varpool_node *node) ...@@ -301,6 +301,10 @@ varpool_assemble_decl (struct varpool_node *node)
&& !targetm.have_tls) && !targetm.have_tls)
return false; return false;
/* Hard register vars do not need to be output. */
if (DECL_HARD_REGISTER (decl))
return false;
gcc_checking_assert (!TREE_ASM_WRITTEN (decl) gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
&& TREE_CODE (decl) == VAR_DECL && TREE_CODE (decl) == VAR_DECL
&& !DECL_HAS_VALUE_EXPR_P (decl)); && !DECL_HAS_VALUE_EXPR_P (decl));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment