/* Callgraph construction.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 2003-2013 Free Software Foundation, Inc.
Contributed by Jan Hubicka
This file is part of GCC.
decl = get_base_var (*tp);
if (TREE_CODE (decl) == FUNCTION_DECL)
{
- struct cgraph_node *node = cgraph_get_create_node (decl);
+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl);
if (!ctx->only_vars)
cgraph_mark_address_taken_node (node);
ipa_record_reference ((symtab_node)ctx->varpool_node,
if (TREE_CODE (decl) == VAR_DECL)
{
- struct varpool_node *vnode = varpool_node (decl);
+ struct varpool_node *vnode = varpool_node_for_decl (decl);
ipa_record_reference ((symtab_node)ctx->varpool_node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
type = TREE_OPERAND (type, 0);
if (TREE_CODE (type) == VAR_DECL)
{
- struct varpool_node *vnode = varpool_node (type);
+ struct varpool_node *vnode = varpool_node_for_decl (type);
ipa_record_reference ((symtab_node)node,
(symtab_node)vnode,
IPA_REF_ADDR, NULL);
{
struct cgraph_node *per_node;
- per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
+ per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl));
ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL);
cgraph_mark_address_taken_node (per_node);
}
addr = get_base_address (addr);
if (TREE_CODE (addr) == FUNCTION_DECL)
{
- struct cgraph_node *node = cgraph_get_create_node (addr);
+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr);
cgraph_mark_address_taken_node (node);
ipa_record_reference ((symtab_node)data,
(symtab_node)node,
else if (addr && TREE_CODE (addr) == VAR_DECL
&& (TREE_STATIC (addr) || DECL_EXTERNAL (addr)))
{
- struct varpool_node *vnode = varpool_node (addr);
+ struct varpool_node *vnode = varpool_node_for_decl (addr);
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
{
/* ??? This can happen on platforms with descriptors when these are
directly manipulated in the code. Pretend that it's an address. */
- struct cgraph_node *node = cgraph_get_create_node (t);
+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (t);
cgraph_mark_address_taken_node (node);
ipa_record_reference ((symtab_node)data,
(symtab_node)node,
else if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
- struct varpool_node *vnode = varpool_node (t);
+ struct varpool_node *vnode = varpool_node_for_decl (t);
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
- struct varpool_node *vnode = varpool_node (t);
+ struct varpool_node *vnode = varpool_node_for_decl (t);
ipa_record_reference ((symtab_node)data,
(symtab_node)vnode,
return false;
}
+/* Record all references from NODE that are taken in statement STMT. */
+void
+ipa_record_stmt_references (struct cgraph_node *node, gimple stmt)
+{
+ walk_stmt_load_store_addr_ops (stmt, node, mark_load, mark_store,
+ mark_address);
+}
+
/* Create cgraph edges for function calls.
Also look for functions and variables having addresses taken. */
gimple_call_flags (stmt),
bb->count, freq);
}
- walk_stmt_load_store_addr_ops (stmt, node, mark_load,
- mark_store, mark_address);
+ ipa_record_stmt_references (node, stmt);
if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
&& gimple_omp_parallel_child_fn (stmt))
{
tree fn = gimple_omp_parallel_child_fn (stmt);
ipa_record_reference ((symtab_node)node,
- (symtab_node)cgraph_get_create_node (fn),
+ (symtab_node)cgraph_get_create_real_symbol_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 ((symtab_node)node,
- (symtab_node) cgraph_get_create_node (fn),
+ (symtab_node) cgraph_get_create_real_symbol_node (fn),
IPA_REF_ADDR, stmt);
fn = gimple_omp_task_copy_fn (stmt);
if (fn)
ipa_record_reference ((symtab_node)node,
- (symtab_node)cgraph_get_create_node (fn),
+ (symtab_node)cgraph_get_create_real_symbol_node (fn),
IPA_REF_ADDR, stmt);
}
}
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
- mark_load, mark_store, mark_address);
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
}
/* Look for initializers of constant variables and private statics. */
{
GIMPLE_PASS,
"*build_cgraph_edges", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
NULL, /* gate */
build_cgraph_edges, /* execute */
NULL, /* sub */
record_references_in_initializer (tree decl, bool only_vars)
{
struct pointer_set_t *visited_nodes = pointer_set_create ();
- struct varpool_node *node = varpool_node (decl);
+ struct varpool_node *node = varpool_node_for_decl (decl);
struct record_reference_ctx ctx = {false, NULL};
ctx.varpool_node = node;
gimple_call_flags (stmt),
bb->count, freq);
}
- walk_stmt_load_store_addr_ops (stmt, node, mark_load,
- mark_store, mark_address);
-
+ ipa_record_stmt_references (node, stmt);
}
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
- mark_load, mark_store, mark_address);
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
}
record_eh_tables (node, cfun);
gcc_assert (!node->global.inlined_to);
FOR_EACH_BB (bb)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple stmt = gsi_stmt (gsi);
-
- walk_stmt_load_store_addr_ops (stmt, node, mark_load,
- mark_store, mark_address);
-
- }
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
- mark_load, mark_store, mark_address);
+ ipa_record_stmt_references (node, gsi_stmt (gsi));
}
record_eh_tables (node, cfun);
}
{
GIMPLE_PASS,
"*rebuild_cgraph_edges", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
NULL, /* gate */
rebuild_cgraph_edges, /* execute */
NULL, /* sub */
{
GIMPLE_PASS,
"*remove_cgraph_callee_edges", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
NULL, /* gate */
remove_cgraph_callee_edges, /* execute */
NULL, /* sub */