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
This commit is contained in:
Jan Hubicka 2012-04-18 11:57:53 +02:00 committed by Jan Hubicka
parent f314862027
commit 5932a4d411
29 changed files with 301 additions and 295 deletions

View file

@ -1,3 +1,76 @@
2012-04-18 Jan Hubicka <jh@suse.cz>
* 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.
2012-04-18 Richard Guenther <rguenther@suse.de>
* cfgloop.h (estimate_numbers_of_iterations_loop): Remove

View file

@ -1178,7 +1178,7 @@ find_base_value (rtx src)
return 0;
case TRUNCATE:
/* As we do not know which address space the pointer is refering to, we can
/* As we do not know which address space the pointer is referring to, we can
handle this only if the target does not support different pointer or
address modes depending on the address space. */
if (!target_default_pointer_address_modes_p ())
@ -1197,7 +1197,7 @@ find_base_value (rtx src)
case ZERO_EXTEND:
case SIGN_EXTEND: /* used for NT/Alpha pointers */
/* As we do not know which address space the pointer is refering to, we can
/* As we do not know which address space the pointer is referring to, we can
handle this only if the target does not support different pointer or
address modes depending on the address space. */
if (!target_default_pointer_address_modes_p ())
@ -1602,7 +1602,7 @@ find_base_term (rtx x)
return REG_BASE_VALUE (x);
case TRUNCATE:
/* As we do not know which address space the pointer is refering to, we can
/* As we do not know which address space the pointer is referring to, we can
handle this only if the target does not support different pointer or
address modes depending on the address space. */
if (!target_default_pointer_address_modes_p ())
@ -1621,7 +1621,7 @@ find_base_term (rtx x)
case ZERO_EXTEND:
case SIGN_EXTEND: /* Used for Alpha/NT pointers */
/* As we do not know which address space the pointer is refering to, we can
/* As we do not know which address space the pointer is referring to, we can
handle this only if the target does not support different pointer or
address modes depending on the address space. */
if (!target_default_pointer_address_modes_p ())
@ -2363,7 +2363,7 @@ nonoverlapping_memrefs_p (const_rtx x, const_rtx y, bool loop_invariant)
&& ! rtx_equal_p (rtlx, rtly))
return 1;
/* If we have MEMs refering to different address spaces (which can
/* If we have MEMs referring to different address spaces (which can
potentially overlap), we cannot easily tell from the addresses
whether the references overlap. */
if (MEM_P (rtlx) && MEM_P (rtly)
@ -2471,7 +2471,7 @@ true_dependence_1 (const_rtx mem, enum machine_mode mem_mode, rtx mem_addr,
if (MEM_READONLY_P (x))
return 0;
/* If we have MEMs refering to different address spaces (which can
/* If we have MEMs referring to different address spaces (which can
potentially overlap), we cannot easily tell from the addresses
whether the references overlap. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
@ -2589,7 +2589,7 @@ write_dependence_p (const_rtx mem, const_rtx x, int writep)
if (!writep && MEM_READONLY_P (mem))
return 0;
/* If we have MEMs refering to different address spaces (which can
/* If we have MEMs referring to different address spaces (which can
potentially overlap), we cannot easily tell from the addresses
whether the references overlap. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
@ -2676,7 +2676,7 @@ may_alias_p (const_rtx mem, const_rtx x)
if (MEM_READONLY_P (x))
return 0;
/* If we have MEMs refering to different address spaces (which can
/* If we have MEMs referring to different address spaces (which can
potentially overlap), we cannot easily tell from the addresses
whether the references overlap. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))

View file

@ -528,8 +528,8 @@ cgraph_same_body_alias (struct cgraph_node *decl_node ATTRIBUTE_UNUSED, tree ali
n = cgraph_create_function_alias (alias, decl);
n->same_body_alias = true;
if (same_body_aliases_done)
ipa_record_reference (n, NULL, cgraph_get_node (decl), NULL, IPA_REF_ALIAS,
NULL);
ipa_record_reference ((symtab_node)n, (symtab_node)cgraph_get_node (decl),
IPA_REF_ALIAS, NULL);
return n;
}
@ -1927,7 +1927,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
for (e = n->indirect_calls; e; e = e->next_callee)
cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid,
count_scale, freq, update_original);
ipa_clone_references (new_node, NULL, &n->symbol.ref_list);
ipa_clone_references ((symtab_node)new_node, &n->symbol.ref_list);
new_node->next_sibling_clone = n->clones;
if (n->clones)
@ -2023,6 +2023,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
FOR_EACH_VEC_ELT (ipa_replace_map_p, tree_map, i, map)
{
tree var = map->new_tree;
symtab_node ref_node;
STRIP_NOPS (var);
if (TREE_CODE (var) != ADDR_EXPR)
@ -2030,19 +2031,16 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
var = get_base_var (var);
if (!var)
continue;
if (TREE_CODE (var) != FUNCTION_DECL
&& TREE_CODE (var) != VAR_DECL)
continue;
/* Record references of the future statement initializing the constant
argument. */
if (TREE_CODE (var) == FUNCTION_DECL)
{
struct cgraph_node *ref_node = cgraph_get_node (var);
gcc_checking_assert (ref_node);
ipa_record_reference (new_node, NULL, ref_node, NULL, IPA_REF_ADDR,
NULL);
}
else if (TREE_CODE (var) == VAR_DECL)
ipa_record_reference (new_node, NULL, NULL, varpool_node (var),
IPA_REF_ADDR, NULL);
ref_node = symtab_get_node (var);
gcc_checking_assert (ref_node);
ipa_record_reference ((symtab_node)new_node, (symtab_node)ref_node,
IPA_REF_ADDR, NULL);
}
if (!args_to_skip)
new_node->clone.combined_args_to_skip = old_node->clone.combined_args_to_skip;
@ -2249,10 +2247,10 @@ cgraph_for_node_thunks_and_aliases (struct cgraph_node *node,
if (cgraph_for_node_thunks_and_aliases (e->caller, callback, data,
include_overwritable))
return true;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
{
struct cgraph_node *alias = ipa_ref_refering_node (ref);
struct cgraph_node *alias = ipa_ref_referring_node (ref);
if (include_overwritable
|| cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
if (cgraph_for_node_thunks_and_aliases (alias, callback, data,
@ -2277,10 +2275,10 @@ cgraph_for_node_and_aliases (struct cgraph_node *node,
if (callback (node, data))
return true;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
{
struct cgraph_node *alias = ipa_ref_refering_node (ref);
struct cgraph_node *alias = ipa_ref_referring_node (ref);
if (include_overwritable
|| cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
if (cgraph_for_node_and_aliases (alias, callback, data,

View file

@ -38,10 +38,6 @@ enum symtab_type
SYMTAB_VARIABLE
};
union symtab_node_def;
typedef union symtab_node_def *symtab_node;
typedef const union symtab_node_def *const_symtab_node;
/* Base of all entries in the symbol table.
The symtab_node is inherited by cgraph and varpol nodes. */
struct GTY(()) symtab_node_base
@ -1166,7 +1162,7 @@ cgraph_alias_aliased_node (struct cgraph_node *n)
ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
gcc_checking_assert (ref->use == IPA_REF_ALIAS);
if (ref->refered_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referred))
return ipa_ref_node (ref);
return NULL;
}
@ -1180,7 +1176,7 @@ varpool_alias_aliased_node (struct varpool_node *n)
ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
gcc_checking_assert (ref->use == IPA_REF_ALIAS);
if (ref->refered_type == IPA_REF_VARPOOL)
if (symtab_variable_p (ref->referred))
return ipa_ref_varpool_node (ref);
return NULL;
}

View file

@ -77,7 +77,8 @@ record_reference (tree *tp, int *walk_subtrees, void *data)
struct cgraph_node *node = cgraph_get_create_node (decl);
if (!ctx->only_vars)
cgraph_mark_address_taken_node (node);
ipa_record_reference (NULL, ctx->varpool_node, node, NULL,
ipa_record_reference ((symtab_node)ctx->varpool_node,
(symtab_node)node,
IPA_REF_ADDR, NULL);
}
@ -87,8 +88,8 @@ record_reference (tree *tp, int *walk_subtrees, void *data)
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees);
varpool_mark_needed_node (vnode);
ipa_record_reference (NULL, ctx->varpool_node,
NULL, vnode,
ipa_record_reference ((symtab_node)ctx->varpool_node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
}
*walk_subtrees = 0;
@ -130,8 +131,8 @@ record_type_list (struct cgraph_node *node, tree list)
{
struct varpool_node *vnode = varpool_node (type);
varpool_mark_needed_node (vnode);
ipa_record_reference (node, NULL,
NULL, vnode,
ipa_record_reference ((symtab_node)node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
}
}
@ -151,7 +152,7 @@ record_eh_tables (struct cgraph_node *node, struct function *fun)
struct cgraph_node *per_node;
per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
ipa_record_reference (node, NULL, per_node, NULL, IPA_REF_ADDR, NULL);
ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL);
cgraph_mark_address_taken_node (per_node);
}
@ -232,8 +233,8 @@ mark_address (gimple stmt, tree addr, void *data)
{
struct cgraph_node *node = cgraph_get_create_node (addr);
cgraph_mark_address_taken_node (node);
ipa_record_reference ((struct cgraph_node *)data, NULL,
node, NULL,
ipa_record_reference ((symtab_node)data,
(symtab_node)node,
IPA_REF_ADDR, stmt);
}
else if (addr && TREE_CODE (addr) == VAR_DECL
@ -245,8 +246,8 @@ mark_address (gimple stmt, tree addr, void *data)
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&addr, &walk_subtrees);
varpool_mark_needed_node (vnode);
ipa_record_reference ((struct cgraph_node *)data, NULL,
NULL, vnode,
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
IPA_REF_ADDR, stmt);
}
@ -265,8 +266,8 @@ mark_load (gimple stmt, tree t, void *data)
directly manipulated in the code. Pretend that it's an address. */
struct cgraph_node *node = cgraph_get_create_node (t);
cgraph_mark_address_taken_node (node);
ipa_record_reference ((struct cgraph_node *)data, NULL,
node, NULL,
ipa_record_reference ((symtab_node)data,
(symtab_node)node,
IPA_REF_ADDR, stmt);
}
else if (t && TREE_CODE (t) == VAR_DECL
@ -278,8 +279,8 @@ mark_load (gimple stmt, tree t, void *data)
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
varpool_mark_needed_node (vnode);
ipa_record_reference ((struct cgraph_node *)data, NULL,
NULL, vnode,
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
IPA_REF_LOAD, stmt);
}
return false;
@ -300,8 +301,8 @@ mark_store (gimple stmt, tree t, void *data)
if (lang_hooks.callgraph.analyze_expr)
lang_hooks.callgraph.analyze_expr (&t, &walk_subtrees);
varpool_mark_needed_node (vnode);
ipa_record_reference ((struct cgraph_node *)data, NULL,
NULL, vnode,
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
IPA_REF_STORE, stmt);
}
return false;
@ -348,19 +349,22 @@ build_cgraph_edges (void)
&& gimple_omp_parallel_child_fn (stmt))
{
tree fn = gimple_omp_parallel_child_fn (stmt);
ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
NULL, IPA_REF_ADDR, stmt);
ipa_record_reference ((symtab_node)node,
(symtab_node)cgraph_get_create_node (fn),
IPA_REF_ADDR, stmt);
}
if (gimple_code (stmt) == GIMPLE_OMP_TASK)
{
tree fn = gimple_omp_task_child_fn (stmt);
if (fn)
ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
NULL, IPA_REF_ADDR, stmt);
ipa_record_reference ((symtab_node)node,
(symtab_node) cgraph_get_create_node (fn),
IPA_REF_ADDR, stmt);
fn = gimple_omp_task_copy_fn (stmt);
if (fn)
ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
NULL, IPA_REF_ADDR, stmt);
ipa_record_reference ((symtab_node)node,
(symtab_node)cgraph_get_create_node (fn),
IPA_REF_ADDR, stmt);
}
}
for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))

View file

@ -930,7 +930,8 @@ cgraph_analyze_function (struct cgraph_node *node)
return;
}
if (!VEC_length (ipa_ref_t, node->symbol.ref_list.references))
ipa_record_reference (node, NULL, tgt, NULL, IPA_REF_ALIAS, NULL);
ipa_record_reference ((symtab_node)node, (symtab_node)tgt,
IPA_REF_ALIAS, NULL);
if (node->same_body_alias)
{
DECL_VIRTUAL_P (node->symbol.decl) = DECL_VIRTUAL_P (node->thunk.alias);
@ -1031,7 +1032,8 @@ cgraph_process_same_body_aliases (void)
&& !VEC_length (ipa_ref_t, node->symbol.ref_list.references))
{
struct cgraph_node *tgt = cgraph_get_node (node->thunk.alias);
ipa_record_reference (node, NULL, tgt, NULL, IPA_REF_ALIAS, NULL);
ipa_record_reference ((symtab_node)node, (symtab_node)tgt,
IPA_REF_ALIAS, NULL);
}
same_body_aliases_done = true;
}
@ -1848,11 +1850,11 @@ assemble_thunks_and_aliases (struct cgraph_node *node)
}
else
e = e->next_caller;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
{
struct cgraph_node *alias = ipa_ref_refering_node (ref);
struct cgraph_node *alias = ipa_ref_referring_node (ref);
bool saved_written = TREE_ASM_WRITTEN (alias->thunk.alias);
/* Force assemble_alias to really output the alias this time instead

View file

@ -2622,7 +2622,7 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse)
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* MEMs refering to different address space are not equivalent. */
/* MEMs referring to different address space are not equivalent. */
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
return 0;

View file

@ -957,10 +957,10 @@ reset_edge_caches (struct cgraph_node *node)
for (edge = where->callers; edge; edge = edge->next_caller)
if (edge->inline_failed)
reset_edge_growth_cache (edge);
for (i = 0; ipa_ref_list_refering_iterate (&where->symbol.ref_list,
for (i = 0; ipa_ref_list_referring_iterate (&where->symbol.ref_list,
i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
reset_edge_caches (ipa_ref_refering_node (ref));
reset_edge_caches (ipa_ref_referring_node (ref));
if (!e)
return;
@ -1009,11 +1009,11 @@ update_caller_keys (fibheap_t heap, struct cgraph_node *node,
if (!bitmap_set_bit (updated_nodes, node->uid))
return;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
{
struct cgraph_node *alias = ipa_ref_refering_node (ref);
struct cgraph_node *alias = ipa_ref_referring_node (ref);
update_caller_keys (heap, alias, updated_nodes, check_inlinablity_for);
}

View file

@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
Conditions that are interesting for function body are collected into CONDS
vector. They are of simple for function_param OP VAL, where VAL is
IPA invariant. The conditions are then refered by predicates. */
IPA invariant. The conditions are then referred by predicates. */
typedef struct GTY(()) condition
{

View file

@ -19,61 +19,51 @@ 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/>. */
/* Return callgraph node REF is refering. */
/* Return callgraph node REF is referring. */
static inline struct cgraph_node *
ipa_ref_node (struct ipa_ref *ref)
{
gcc_assert (ref->refered_type == IPA_REF_CGRAPH);
return ref->refered.cgraph_node;
return cgraph (ref->referred);
}
/* Return varpool node REF is refering. */
/* Return varpool node REF is referring. */
static inline struct varpool_node *
ipa_ref_varpool_node (struct ipa_ref *ref)
{
gcc_assert (ref->refered_type == IPA_REF_VARPOOL);
return ref->refered.varpool_node;
return varpool (ref->referred);
}
/* Return cgraph node REF is in. */
static inline struct cgraph_node *
ipa_ref_refering_node (struct ipa_ref *ref)
ipa_ref_referring_node (struct ipa_ref *ref)
{
gcc_assert (ref->refering_type == IPA_REF_CGRAPH);
return ref->refering.cgraph_node;
return cgraph (ref->referring);
}
/* Return varpool node REF is in. */
static inline struct varpool_node *
ipa_ref_refering_varpool_node (struct ipa_ref *ref)
ipa_ref_referring_varpool_node (struct ipa_ref *ref)
{
gcc_assert (ref->refering_type == IPA_REF_VARPOOL);
return ref->refering.varpool_node;
return varpool (ref->referring);
}
/* Return reference list REF is in. */
static inline struct ipa_ref_list *
ipa_ref_refering_ref_list (struct ipa_ref *ref)
ipa_ref_referring_ref_list (struct ipa_ref *ref)
{
if (ref->refering_type == IPA_REF_CGRAPH)
return &ipa_ref_refering_node (ref)->symbol.ref_list;
else
return &ipa_ref_refering_varpool_node (ref)->symbol.ref_list;
return &ref->referring->symbol.ref_list;
}
/* Return reference list REF is in. */
static inline struct ipa_ref_list *
ipa_ref_refered_ref_list (struct ipa_ref *ref)
ipa_ref_referred_ref_list (struct ipa_ref *ref)
{
if (ref->refered_type == IPA_REF_CGRAPH)
return &ipa_ref_node (ref)->symbol.ref_list;
else
return &ipa_ref_varpool_node (ref)->symbol.ref_list;
return &ref->referred->symbol.ref_list;
}
/* Return first reference in LIST or NULL if empty. */
@ -86,14 +76,14 @@ ipa_ref_list_first_reference (struct ipa_ref_list *list)
return VEC_index (ipa_ref_t, list->references, 0);
}
/* Return first refering ref in LIST or NULL if empty. */
/* Return first referring ref in LIST or NULL if empty. */
static inline struct ipa_ref *
ipa_ref_list_first_refering (struct ipa_ref_list *list)
ipa_ref_list_first_referring (struct ipa_ref_list *list)
{
if (!VEC_length (ipa_ref_ptr, list->refering))
if (!VEC_length (ipa_ref_ptr, list->referring))
return NULL;
return VEC_index (ipa_ref_ptr, list->refering, 0);
return VEC_index (ipa_ref_ptr, list->referring, 0);
}
/* Clear reference list. */
@ -101,7 +91,7 @@ ipa_ref_list_first_refering (struct ipa_ref_list *list)
static inline void
ipa_empty_ref_list (struct ipa_ref_list *list)
{
list->refering = NULL;
list->referring = NULL;
list->references = NULL;
}
@ -115,5 +105,5 @@ ipa_ref_list_nreferences (struct ipa_ref_list *list)
#define ipa_ref_list_reference_iterate(L,I,P) \
VEC_iterate(ipa_ref_t, (L)->references, (I), (P))
#define ipa_ref_list_refering_iterate(L,I,P) \
VEC_iterate(ipa_ref_ptr, (L)->refering, (I), (P))
#define ipa_ref_list_referring_iterate(L,I,P) \
VEC_iterate(ipa_ref_ptr, (L)->referring, (I), (P))

View file

@ -1,5 +1,5 @@
/* Interprocedural reference lists.
Copyright (C) 2010
Copyright (C) 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Jan Hubicka
@ -34,54 +34,28 @@ static const char *ipa_ref_use_name[] = {"read","write","addr","alias"};
of the use and STMT the statement (if it exists). */
struct ipa_ref *
ipa_record_reference (struct cgraph_node *refering_node,
struct varpool_node *refering_varpool_node,
struct cgraph_node *refered_node,
struct varpool_node *refered_varpool_node,
ipa_record_reference (symtab_node referring_node,
symtab_node referred_node,
enum ipa_ref_use use_type, gimple stmt)
{
struct ipa_ref *ref;
struct ipa_ref_list *list, *list2;
VEC(ipa_ref_t,gc) *old_references;
gcc_assert ((!refering_node) ^ (!refering_varpool_node));
gcc_assert ((!refered_node) ^ (!refered_varpool_node));
gcc_assert (!stmt || refering_node);
gcc_assert (use_type != IPA_REF_ALIAS || !stmt);
list = (refering_node ? &refering_node->symbol.ref_list
: &refering_varpool_node->symbol.ref_list);
gcc_checking_assert (!stmt || symtab_function_p (referring_node));
gcc_checking_assert (use_type != IPA_REF_ALIAS || !stmt);
list = &referring_node->symbol.ref_list;
old_references = list->references;
VEC_safe_grow (ipa_ref_t, gc, list->references,
VEC_length (ipa_ref_t, list->references) + 1);
ref = VEC_last (ipa_ref_t, list->references);
list2 = (refered_node ? &refered_node->symbol.ref_list
: &refered_varpool_node->symbol.ref_list);
VEC_safe_push (ipa_ref_ptr, heap, list2->refering, ref);
ref->refered_index = VEC_length (ipa_ref_ptr, list2->refering) - 1;
if (refering_node)
{
ref->refering.cgraph_node = refering_node;
ref->refering_type = IPA_REF_CGRAPH;
}
else
{
ref->refering.varpool_node = refering_varpool_node;
ref->refering_type = IPA_REF_VARPOOL;
gcc_assert (use_type == IPA_REF_ADDR || use_type == IPA_REF_ALIAS);
}
if (refered_node)
{
ref->refered.cgraph_node = refered_node;
ref->refered_type = IPA_REF_CGRAPH;
gcc_assert (use_type == IPA_REF_ADDR || use_type == IPA_REF_ALIAS);
}
else
{
varpool_mark_needed_node (refered_varpool_node);
ref->refered.varpool_node = refered_varpool_node;
ref->refered_type = IPA_REF_VARPOOL;
}
list2 = &referred_node->symbol.ref_list;
VEC_safe_push (ipa_ref_ptr, heap, list2->referring, ref);
ref->referred_index = VEC_length (ipa_ref_ptr, list2->referring) - 1;
ref->referring = referring_node;
ref->referred = referred_node;
ref->stmt = stmt;
ref->use = use_type;
@ -91,8 +65,8 @@ ipa_record_reference (struct cgraph_node *refering_node,
int i;
for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
VEC_replace (ipa_ref_ptr,
ipa_ref_refered_ref_list (ref)->refering,
ref->refered_index, ref);
ipa_ref_referred_ref_list (ref)->referring,
ref->referred_index, ref);
}
return ref;
}
@ -102,30 +76,30 @@ ipa_record_reference (struct cgraph_node *refering_node,
void
ipa_remove_reference (struct ipa_ref *ref)
{
struct ipa_ref_list *list = ipa_ref_refered_ref_list (ref);
struct ipa_ref_list *list2 = ipa_ref_refering_ref_list (ref);
struct ipa_ref_list *list = ipa_ref_referred_ref_list (ref);
struct ipa_ref_list *list2 = ipa_ref_referring_ref_list (ref);
VEC(ipa_ref_t,gc) *old_references = list2->references;
struct ipa_ref *last;
gcc_assert (VEC_index (ipa_ref_ptr, list->refering, ref->refered_index) == ref);
last = VEC_last (ipa_ref_ptr, list->refering);
gcc_assert (VEC_index (ipa_ref_ptr, list->referring, ref->referred_index) == ref);
last = VEC_last (ipa_ref_ptr, list->referring);
if (ref != last)
{
VEC_replace (ipa_ref_ptr, list->refering,
ref->refered_index,
VEC_last (ipa_ref_ptr, list->refering));
VEC_index (ipa_ref_ptr, list->refering,
ref->refered_index)->refered_index = ref->refered_index;
VEC_replace (ipa_ref_ptr, list->referring,
ref->referred_index,
VEC_last (ipa_ref_ptr, list->referring));
VEC_index (ipa_ref_ptr, list->referring,
ref->referred_index)->referred_index = ref->referred_index;
}
VEC_pop (ipa_ref_ptr, list->refering);
VEC_pop (ipa_ref_ptr, list->referring);
last = VEC_last (ipa_ref_t, list2->references);
if (ref != last)
{
*ref = *last;
VEC_replace (ipa_ref_ptr,
ipa_ref_refered_ref_list (ref)->refering,
ref->refered_index, ref);
ipa_ref_referred_ref_list (ref)->referring,
ref->referred_index, ref);
}
VEC_pop (ipa_ref_t, list2->references);
gcc_assert (list2->references == old_references);
@ -145,12 +119,12 @@ ipa_remove_all_references (struct ipa_ref_list *list)
/* Remove all references in ref list LIST. */
void
ipa_remove_all_refering (struct ipa_ref_list *list)
ipa_remove_all_referring (struct ipa_ref_list *list)
{
while (VEC_length (ipa_ref_ptr, list->refering))
ipa_remove_reference (VEC_last (ipa_ref_ptr, list->refering));
VEC_free (ipa_ref_ptr, heap, list->refering);
list->refering = NULL;
while (VEC_length (ipa_ref_ptr, list->referring))
ipa_remove_reference (VEC_last (ipa_ref_ptr, list->referring));
VEC_free (ipa_ref_ptr, heap, list->referring);
list->referring = NULL;
}
/* Dump references in LIST to FILE. */
@ -162,38 +136,27 @@ ipa_dump_references (FILE * file, struct ipa_ref_list *list)
int i;
for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
{
if (ref->refered_type == IPA_REF_CGRAPH)
{
fprintf (file, " fn:%s/%i (%s)", cgraph_node_asm_name (ipa_ref_node (ref)),
ipa_ref_node (ref)->symbol.order,
ipa_ref_use_name [ref->use]);
}
else
fprintf (file, " var:%s (%s)",
varpool_node_asm_name (ipa_ref_varpool_node (ref)),
ipa_ref_use_name [ref->use]);
fprintf (file, "%s/%i (%s)",
symtab_node_asm_name (ref->referred),
ref->referred->symbol.order,
ipa_ref_use_name [ref->use]);
}
fprintf (file, "\n");
}
/* Dump refering in LIST to FILE. */
/* Dump referring in LIST to FILE. */
void
ipa_dump_refering (FILE * file, struct ipa_ref_list *list)
ipa_dump_referring (FILE * file, struct ipa_ref_list *list)
{
struct ipa_ref *ref;
int i;
for (i = 0; ipa_ref_list_refering_iterate (list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
{
if (ref->refering_type == IPA_REF_CGRAPH)
fprintf (file, " fn:%s/%i (%s)",
cgraph_node_asm_name (ipa_ref_refering_node (ref)),
ipa_ref_refering_node (ref)->symbol.order,
ipa_ref_use_name [ref->use]);
else
fprintf (file, " var:%s (%s)",
varpool_node_asm_name (ipa_ref_refering_varpool_node (ref)),
ipa_ref_use_name [ref->use]);
fprintf (file, "%s/%i (%s)",
symtab_node_asm_name (ref->referring),
ref->referring->symbol.order,
ipa_ref_use_name [ref->use]);
}
fprintf (file, "\n");
}
@ -201,46 +164,37 @@ ipa_dump_refering (FILE * file, struct ipa_ref_list *list)
/* Clone all references from SRC to DEST_NODE or DEST_VARPOOL_NODE. */
void
ipa_clone_references (struct cgraph_node *dest_node,
struct varpool_node *dest_varpool_node,
ipa_clone_references (symtab_node dest_node,
struct ipa_ref_list *src)
{
struct ipa_ref *ref;
int i;
for (i = 0; ipa_ref_list_reference_iterate (src, i, ref); i++)
ipa_record_reference (dest_node, dest_varpool_node,
ref->refered_type == IPA_REF_CGRAPH
? ipa_ref_node (ref) : NULL,
ref->refered_type == IPA_REF_VARPOOL
? ipa_ref_varpool_node (ref) : NULL,
ipa_record_reference (dest_node,
ref->referred,
ref->use, ref->stmt);
}
/* Clone all refering from SRC to DEST_NODE or DEST_VARPOOL_NODE. */
/* Clone all referring from SRC to DEST_NODE or DEST_VARPOOL_NODE. */
void
ipa_clone_refering (struct cgraph_node *dest_node,
struct varpool_node *dest_varpool_node,
ipa_clone_referring (symtab_node dest_node,
struct ipa_ref_list *src)
{
struct ipa_ref *ref;
int i;
for (i = 0; ipa_ref_list_refering_iterate (src, i, ref); i++)
ipa_record_reference (
ref->refering_type == IPA_REF_CGRAPH
? ipa_ref_refering_node (ref) : NULL,
ref->refering_type == IPA_REF_VARPOOL
? ipa_ref_refering_varpool_node (ref) : NULL,
dest_node, dest_varpool_node,
for (i = 0; ipa_ref_list_referring_iterate (src, i, ref); i++)
ipa_record_reference (ref->referring,
dest_node,
ref->use, ref->stmt);
}
/* Return true when execution of REF can load to return from
/* Return true when execution of REF can lead to return from
function. */
bool
ipa_ref_cannot_lead_to_return (struct ipa_ref *ref)
{
return cgraph_node_cannot_return (ipa_ref_refering_node (ref));
return cgraph_node_cannot_return (ipa_ref_referring_node (ref));
}
/* Return true if list contains an alias. */
@ -249,7 +203,7 @@ ipa_ref_has_aliases_p (struct ipa_ref_list *ref_list)
{
struct ipa_ref *ref;
int i;
for (i = 0; ipa_ref_list_refering_iterate (ref_list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (ref_list, i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
return true;
return false;

View file

@ -21,6 +21,10 @@ along with GCC; see the file COPYING3. If not see
struct cgraph_node;
struct varpool_node;
union symtab_node_def;
typedef union symtab_node_def *symtab_node;
typedef const union symtab_node_def *const_symtab_node;
/* How the reference is done. */
enum GTY(()) ipa_ref_use
@ -31,30 +35,13 @@ enum GTY(()) ipa_ref_use
IPA_REF_ALIAS
};
/* Type of refering or refered type. */
enum GTY(()) ipa_ref_type
{
IPA_REF_CGRAPH,
IPA_REF_VARPOOL
};
/* We can have references spanning both callgraph and varpool,
so all pointers needs to be of both types. */
union GTY(()) ipa_ref_ptr_u
{
struct cgraph_node * GTY((tag ("IPA_REF_CGRAPH"))) cgraph_node;
struct varpool_node * GTY((tag ("IPA_REF_VARPOOL"))) varpool_node;
};
/* Record of reference in callgraph or varpool. */
struct GTY(()) ipa_ref
{
union ipa_ref_ptr_u GTY ((desc ("%1.refering_type"))) refering;
union ipa_ref_ptr_u GTY ((desc ("%1.refered_type"))) refered;
symtab_node referring;
symtab_node referred;
gimple stmt;
unsigned int refered_index;
ENUM_BITFIELD (ipa_ref_type) refering_type:1;
ENUM_BITFIELD (ipa_ref_type) refered_type:1;
unsigned int referred_index;
ENUM_BITFIELD (ipa_ref_use) use:2;
};
@ -73,21 +60,19 @@ struct GTY(()) ipa_ref_list
VEC(ipa_ref_t,gc) *references;
/* Refering is vector of pointers to references. It must not live in GGC space
or GGC will try to mark middle of references vectors. */
VEC(ipa_ref_ptr,heap) * GTY((skip)) refering;
VEC(ipa_ref_ptr,heap) * GTY((skip)) referring;
};
struct ipa_ref * ipa_record_reference (struct cgraph_node *,
struct varpool_node *,
struct cgraph_node *,
struct varpool_node *,
struct ipa_ref * ipa_record_reference (symtab_node,
symtab_node,
enum ipa_ref_use, gimple);
void ipa_remove_reference (struct ipa_ref *);
void ipa_remove_all_references (struct ipa_ref_list *);
void ipa_remove_all_refering (struct ipa_ref_list *);
void ipa_remove_all_referring (struct ipa_ref_list *);
void ipa_dump_references (FILE *, struct ipa_ref_list *);
void ipa_dump_refering (FILE *, struct ipa_ref_list *);
void ipa_clone_references (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
void ipa_clone_refering (struct cgraph_node *, struct varpool_node *, struct ipa_ref_list *);
void ipa_dump_referring (FILE *, struct ipa_ref_list *);
void ipa_clone_references (symtab_node, struct ipa_ref_list *);
void ipa_clone_referring (symtab_node, struct ipa_ref_list *);
bool ipa_ref_cannot_lead_to_return (struct ipa_ref *);
bool ipa_ref_has_aliases_p (struct ipa_ref_list *);

View file

@ -435,7 +435,7 @@ analyze_function (struct cgraph_node *fn)
local = init_function_info (fn);
for (i = 0; ipa_ref_list_reference_iterate (&fn->symbol.ref_list, i, ref); i++)
{
if (ref->refered_type != IPA_REF_VARPOOL)
if (!symtab_variable_p (ref->referred))
continue;
var = ipa_ref_varpool_node (ref)->symbol.decl;
if (ipa_ref_varpool_node (ref)->symbol.externally_visible

View file

@ -295,13 +295,13 @@ ipa_reverse_postorder (struct cgraph_node **order)
(cgraph_function_node (edge->callee, NULL)->symbol.decl))
node2 = NULL;
}
for (;ipa_ref_list_refering_iterate (&stack[stack_size].node->symbol.ref_list,
for (;ipa_ref_list_referring_iterate (&stack[stack_size].node->symbol.ref_list,
stack[stack_size].ref,
ref) && !node2;
stack[stack_size].ref++)
{
if (ref->use == IPA_REF_ALIAS)
node2 = ipa_ref_refering_node (ref);
node2 = ipa_ref_referring_node (ref);
}
if (!node2)
break;

View file

@ -91,7 +91,7 @@ process_references (struct ipa_ref_list *list,
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
{
if (ref->refered_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referred))
{
struct cgraph_node *node = ipa_ref_node (ref);
if (!node->reachable
@ -154,7 +154,7 @@ has_addr_references_p (struct cgraph_node *node,
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
i, ref); i++)
if (ref->use == IPA_REF_ADDR)
return true;
@ -352,14 +352,14 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
for (e = node->callers; e && !found; e = e->next_caller)
if (e->caller->reachable)
found = true;
for (i = 0; (ipa_ref_list_refering_iterate (&node->symbol.ref_list,
for (i = 0; (ipa_ref_list_referring_iterate (&node->symbol.ref_list,
i, ref)
&& !found); i++)
if (ref->refering_type == IPA_REF_CGRAPH
&& ipa_ref_refering_node (ref)->reachable)
if (symtab_function_p (ref->referring)
&& ipa_ref_referring_node (ref)->reachable)
found = true;
else if (ref->refering_type == IPA_REF_VARPOOL
&& ipa_ref_refering_varpool_node (ref)->needed)
else if (symtab_variable_p (ref->referring)
&& ipa_ref_referring_varpool_node (ref)->needed)
found = true;
/* If so, we need to keep node in the callgraph. */
@ -501,7 +501,7 @@ ipa_discover_readonly_nonaddressable_vars (void)
bool address_taken = false;
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_refering_iterate (&vnode->symbol.ref_list,
for (i = 0; ipa_ref_list_referring_iterate (&vnode->symbol.ref_list,
i, ref)
&& (!written || !address_taken); i++)
switch (ref->use)
@ -542,14 +542,14 @@ cgraph_address_taken_from_non_vtable_p (struct cgraph_node *node)
{
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list,
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list,
i, ref); i++)
if (ref->use == IPA_REF_ADDR)
{
struct varpool_node *node;
if (ref->refering_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referring))
return true;
node = ipa_ref_refering_varpool_node (ref);
node = ipa_ref_referring_varpool_node (ref);
if (!DECL_VIRTUAL_P (node->symbol.decl))
return true;
}

View file

@ -1764,7 +1764,7 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y)
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* MEMs refering to different address space are not equivalent. */
/* MEMs referring to different address space are not equivalent. */
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
return 0;

View file

@ -326,18 +326,18 @@ referenced_from_other_partition_p (struct ipa_ref_list *list, cgraph_node_set se
{
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_refering_iterate (list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
{
if (ref->refering_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referring))
{
if (ipa_ref_refering_node (ref)->symbol.in_other_partition
|| !cgraph_node_in_set_p (ipa_ref_refering_node (ref), set))
if (ipa_ref_referring_node (ref)->symbol.in_other_partition
|| !cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
return true;
}
else
{
if (ipa_ref_refering_varpool_node (ref)->symbol.in_other_partition
|| !varpool_node_in_set_p (ipa_ref_refering_varpool_node (ref),
if (ipa_ref_referring_varpool_node (ref)->symbol.in_other_partition
|| !varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
vset))
return true;
}
@ -370,16 +370,16 @@ referenced_from_this_partition_p (struct ipa_ref_list *list, cgraph_node_set set
{
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_refering_iterate (list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
{
if (ref->refering_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referring))
{
if (cgraph_node_in_set_p (ipa_ref_refering_node (ref), set))
if (cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
return true;
}
else
{
if (varpool_node_in_set_p (ipa_ref_refering_varpool_node (ref),
if (varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
vset))
return true;
}
@ -614,10 +614,10 @@ lto_output_ref (struct lto_simple_output_block *ob, struct ipa_ref *ref,
{
struct bitpack_d bp;
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, ref->refered_type, 1);
bp_pack_value (&bp, symtab_function_p (ref->referred), 1);
bp_pack_value (&bp, ref->use, 2);
streamer_write_bitpack (&bp);
if (ref->refered_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referred))
{
int nref = lto_cgraph_encoder_lookup (encoder, ipa_ref_node (ref));
gcc_assert (nref != LCC_NOT_FOUND);
@ -674,7 +674,7 @@ add_references (lto_cgraph_encoder_t encoder,
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
if (ref->refered_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referred))
add_node_to (encoder, ipa_ref_node (ref), false);
else
{
@ -1108,27 +1108,26 @@ input_varpool_node (struct lto_file_decl_data *file_data,
static void
input_ref (struct lto_input_block *ib,
struct cgraph_node *refering_node,
struct varpool_node *refering_varpool_node,
symtab_node referring_node,
VEC(cgraph_node_ptr, heap) *nodes,
VEC(varpool_node_ptr, heap) *varpool_nodes_vec)
{
struct cgraph_node *node = NULL;
struct varpool_node *varpool_node = NULL;
struct bitpack_d bp;
enum ipa_ref_type type;
int type;
enum ipa_ref_use use;
bp = streamer_read_bitpack (ib);
type = (enum ipa_ref_type) bp_unpack_value (&bp, 1);
type = bp_unpack_value (&bp, 1);
use = (enum ipa_ref_use) bp_unpack_value (&bp, 2);
if (type == IPA_REF_CGRAPH)
if (type)
node = VEC_index (cgraph_node_ptr, nodes, streamer_read_hwi (ib));
else
varpool_node = VEC_index (varpool_node_ptr, varpool_nodes_vec,
streamer_read_hwi (ib));
ipa_record_reference (refering_node, refering_varpool_node,
node, varpool_node, use, NULL);
ipa_record_reference (referring_node,
node ? (symtab_node) node : (symtab_node) varpool_node, use, NULL);
}
/* Read an edge from IB. NODES points to a vector of previously read nodes for
@ -1324,7 +1323,7 @@ input_refs (struct lto_input_block *ib,
node = VEC_index (cgraph_node_ptr, nodes, idx);
while (count)
{
input_ref (ib, node, NULL, nodes, varpool);
input_ref (ib, (symtab_node) node, nodes, varpool);
count--;
}
}
@ -1338,7 +1337,7 @@ input_refs (struct lto_input_block *ib,
streamer_read_uhwi (ib));
while (count)
{
input_ref (ib, NULL, node, nodes, varpool);
input_ref (ib, (symtab_node) node, nodes, varpool);
count--;
}
}

View file

@ -249,7 +249,7 @@ lto_cgraph_replace_node (struct cgraph_node *node,
e->call_stmt_cannot_inline_p = 1;
}
/* Redirect incomming references. */
ipa_clone_refering (prevailing_node, NULL, &node->symbol.ref_list);
ipa_clone_referring ((symtab_node)prevailing_node, &node->symbol.ref_list);
/* Finally remove the replaced node. */
cgraph_remove_node (node);
@ -271,7 +271,7 @@ lto_varpool_replace_node (struct varpool_node *vnode,
gcc_assert (!vnode->finalized || prevailing_node->finalized);
gcc_assert (!vnode->analyzed || prevailing_node->analyzed);
ipa_clone_refering (NULL, prevailing_node, &vnode->symbol.ref_list);
ipa_clone_referring ((symtab_node)prevailing_node, &vnode->symbol.ref_list);
/* Be sure we can garbage collect the initializer. */
if (DECL_INITIAL (vnode->symbol.decl))

View file

@ -1,3 +1,8 @@
2012-04-18 Jan Hubicka <jh@suse.cz>
* lto-partition.c (add_references_to_partition, lto_balanced_map):
Update for new ipa-ref API.
2012-04-16 Jan Hubicka <jh@suse.cz>
* lto.c (read_cgraph_and_symbols): Use FOR_EACH

View file

@ -72,7 +72,7 @@ add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs)
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_reference_iterate (refs, i, ref); i++)
{
if (ref->refered_type == IPA_REF_CGRAPH
if (symtab_function_p (ref->referred)
&& (DECL_COMDAT (cgraph_function_node (ipa_ref_node (ref),
NULL)->symbol.decl)
|| (ref->use == IPA_REF_ALIAS
@ -81,7 +81,7 @@ add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs)
&& !cgraph_node_in_set_p (ipa_ref_node (ref), part->cgraph_set))
add_cgraph_node_to_partition (part, ipa_ref_node (ref));
else
if (ref->refered_type == IPA_REF_VARPOOL
if (symtab_variable_p (ref->referred)
&& (DECL_COMDAT (ipa_ref_varpool_node (ref)->symbol.decl)
|| (ref->use == IPA_REF_ALIAS
&& lookup_attribute
@ -91,26 +91,26 @@ add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs)
part->varpool_set))
add_varpool_node_to_partition (part, ipa_ref_varpool_node (ref));
}
for (i = 0; ipa_ref_list_refering_iterate (refs, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (refs, i, ref); i++)
{
if (ref->refering_type == IPA_REF_CGRAPH
if (symtab_function_p (ref->referring)
&& ref->use == IPA_REF_ALIAS
&& !cgraph_node_in_set_p (ipa_ref_refering_node (ref),
&& !cgraph_node_in_set_p (ipa_ref_referring_node (ref),
part->cgraph_set)
&& !lookup_attribute ("weakref",
DECL_ATTRIBUTES
(ipa_ref_refering_node (ref)->symbol.decl)))
add_cgraph_node_to_partition (part, ipa_ref_refering_node (ref));
(ipa_ref_referring_node (ref)->symbol.decl)))
add_cgraph_node_to_partition (part, ipa_ref_referring_node (ref));
else
if (ref->refering_type == IPA_REF_VARPOOL
if (symtab_variable_p (ref->referring)
&& ref->use == IPA_REF_ALIAS
&& !varpool_node_in_set_p (ipa_ref_refering_varpool_node (ref),
&& !varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
part->varpool_set)
&& !lookup_attribute ("weakref",
DECL_ATTRIBUTES
(ipa_ref_refering_varpool_node (ref)->symbol.decl)))
(ipa_ref_referring_varpool_node (ref)->symbol.decl)))
add_varpool_node_to_partition (part,
ipa_ref_refering_varpool_node (ref));
ipa_ref_referring_varpool_node (ref));
}
}
@ -612,7 +612,7 @@ lto_balanced_map (void)
/* Compute boundary cost of IPA REF edges and at the same time look into
variables referenced from current partition and try to add them. */
for (j = 0; ipa_ref_list_reference_iterate (refs, j, ref); j++)
if (ref->refered_type == IPA_REF_VARPOOL)
if (symtab_variable_p (ref->referred))
{
varpool_node_set_iterator vsi;
@ -643,12 +643,12 @@ lto_balanced_map (void)
else
cost++;
}
for (j = 0; ipa_ref_list_refering_iterate (refs, j, ref); j++)
if (ref->refering_type == IPA_REF_VARPOOL)
for (j = 0; ipa_ref_list_referring_iterate (refs, j, ref); j++)
if (symtab_variable_p (ref->referring))
{
varpool_node_set_iterator vsi;
vnode = ipa_ref_refering_varpool_node (ref);
vnode = ipa_ref_referring_varpool_node (ref);
gcc_assert (vnode->finalized);
if (!vnode->symbol.aux && flag_toplevel_reorder
&& partition_varpool_node_p (vnode))
@ -664,7 +664,7 @@ lto_balanced_map (void)
{
cgraph_node_set_iterator csi;
node = ipa_ref_refering_node (ref);
node = ipa_ref_referring_node (ref);
gcc_assert (node->analyzed);
csi = cgraph_node_set_find (partition->cgraph_set, node);
if (!csi_end_p (csi)
@ -876,7 +876,7 @@ lto_promote_cross_file_statics (void)
ipa_ref_list_reference_iterate (&vnode->symbol.ref_list, i, ref);
i++)
{
if (ref->refered_type == IPA_REF_CGRAPH)
if (symtab_function_p (ref->referred))
{
struct cgraph_node *n = ipa_ref_node (ref);
gcc_assert (!n->global.inlined_to);

View file

@ -2258,7 +2258,7 @@ operands_match_p (rtx x, rtx y)
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* MEMs refering to different address space are not equivalent. */
/* MEMs referring to different address space are not equivalent. */
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
return 0;

View file

@ -381,7 +381,7 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* MEMs refering to different address space are not equivalent. */
/* MEMs referring to different address space are not equivalent. */
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
return 0;
@ -520,7 +520,7 @@ rtx_equal_p (const_rtx x, const_rtx y)
if (GET_MODE (x) != GET_MODE (y))
return 0;
/* MEMs refering to different address space are not equivalent. */
/* MEMs referring to different address space are not equivalent. */
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
return 0;

View file

@ -3981,7 +3981,7 @@ nonzero_bits1 (const_rtx x, enum machine_mode mode, const_rtx known_x,
#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
/* If pointers extend unsigned and this is a pointer in Pmode, say that
all the bits above ptr_mode are known to be zero. */
/* As we do not know which address space the pointer is refering to,
/* As we do not know which address space the pointer is referring to,
we can do this only if the target does not support different pointer
or address modes depending on the address space. */
if (target_default_pointer_address_modes_p ()
@ -4491,7 +4491,7 @@ num_sign_bit_copies1 (const_rtx x, enum machine_mode mode, const_rtx known_x,
#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
/* If pointers extend signed and this is a pointer in Pmode, say that
all the bits above ptr_mode are known to be sign bit copies. */
/* As we do not know which address space the pointer is refering to,
/* As we do not know which address space the pointer is referring to,
we can do this only if the target does not support different pointer
or address modes depending on the address space. */
if (target_default_pointer_address_modes_p ()

View file

@ -1140,7 +1140,7 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
}
#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
/* As we do not know which address space the pointer is refering to,
/* As we do not know which address space the pointer is referring to,
we can do this only if the target does not support different pointer
or address modes depending on the address space. */
if (target_default_pointer_address_modes_p ()
@ -1233,7 +1233,7 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
}
#if defined(POINTERS_EXTEND_UNSIGNED) && !defined(HAVE_ptr_extend)
/* As we do not know which address space the pointer is refering to,
/* As we do not know which address space the pointer is referring to,
we can do this only if the target does not support different pointer
or address modes depending on the address space. */
if (target_default_pointer_address_modes_p ()

View file

@ -191,7 +191,7 @@ symtab_unregister_node (symtab_node node)
{
void **slot;
ipa_remove_all_references (&node->symbol.ref_list);
ipa_remove_all_refering (&node->symbol.ref_list);
ipa_remove_all_referring (&node->symbol.ref_list);
if (node->symbol.same_comdat_group)
{
@ -429,8 +429,8 @@ dump_symtab_base (FILE *f, symtab_node node)
fprintf (f, " References: ");
ipa_dump_references (f, &node->symbol.ref_list);
fprintf (f, " Refering: ");
ipa_dump_refering (f, &node->symbol.ref_list);
fprintf (f, " Referring: ");
ipa_dump_referring (f, &node->symbol.ref_list);
}
/* Dump symtab node. */

View file

@ -4931,9 +4931,9 @@ ipa_tm_execute (void)
}
/* Propagate back to referring aliases as well. */
for (j = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, j, ref); j++)
for (j = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, j, ref); j++)
{
caller = ref->refering.cgraph_node;
caller = cgraph (ref->referring);
if (ref->use == IPA_REF_ALIAS
&& !caller->local.tm_may_enter_irr)
{

View file

@ -446,7 +446,7 @@ gen_emutls_addr (tree decl, struct lower_emutls_data *d)
/* We may be adding a new reference to a new variable to the function.
This means we have to play with the ipa-reference web. */
ipa_record_reference (d->cfun_node, NULL, NULL, cvar, IPA_REF_ADDR, x);
ipa_record_reference ((symtab_node)d->cfun_node, (symtab_node)cvar, IPA_REF_ADDR, x);
/* Record this ssa_name for possible use later in the basic block. */
VEC_replace (tree, access_vars, index, addr);

View file

@ -1010,7 +1010,7 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
|| CONSTANT_CLASS_P (base2))
return false;
/* We can end up refering to code via function and label decls.
/* We can end up referring to code via function and label decls.
As we likely do not properly track code aliases conservatively
bail out. */
if (TREE_CODE (base1) == FUNCTION_DECL

View file

@ -380,7 +380,7 @@ varpool_analyze_pending_decls (void)
continue;
}
if (!VEC_length (ipa_ref_t, node->symbol.ref_list.references))
ipa_record_reference (NULL, node, NULL, tgt, IPA_REF_ALIAS, NULL);
ipa_record_reference ((symtab_node)node, (symtab_node)tgt, IPA_REF_ALIAS, NULL);
/* C++ FE sometimes change linkage flags after producing same body aliases. */
if (node->extra_name_alias)
{
@ -433,10 +433,10 @@ assemble_aliases (struct varpool_node *node)
{
int i;
struct ipa_ref *ref;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
{
struct varpool_node *alias = ipa_ref_refering_varpool_node (ref);
struct varpool_node *alias = ipa_ref_referring_varpool_node (ref);
assemble_alias (alias->symbol.decl,
DECL_ASSEMBLER_NAME (alias->alias_of));
assemble_aliases (alias);
@ -676,10 +676,10 @@ varpool_for_node_and_aliases (struct varpool_node *node,
if (callback (node, data))
return true;
for (i = 0; ipa_ref_list_refering_iterate (&node->symbol.ref_list, i, ref); i++)
for (i = 0; ipa_ref_list_referring_iterate (&node->symbol.ref_list, i, ref); i++)
if (ref->use == IPA_REF_ALIAS)
{
struct varpool_node *alias = ipa_ref_refering_varpool_node (ref);
struct varpool_node *alias = ipa_ref_referring_varpool_node (ref);
if (include_overwritable
|| cgraph_variable_initializer_availability (alias) > AVAIL_OVERWRITABLE)
if (varpool_for_node_and_aliases (alias, callback, data,