void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
- if (TREE_CODE (t) == VAR_DECL
+ if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
- if (TREE_CODE (t) == VAR_DECL
+ if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
struct cgraph_node *node = cgraph_node (current_function_decl);
struct pointer_set_t *visited_nodes = pointer_set_create ();
gimple_stmt_iterator gsi;
- tree step;
+ tree decl;
+ unsigned ix;
/* Create the callgraph edges and record the nodes referenced by the function.
body. */
gimple stmt = gsi_stmt (gsi);
tree decl;
- if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt)))
- cgraph_create_edge (node, cgraph_node (decl), stmt,
- bb->count,
- compute_call_stmt_bb_frequency
- (current_function_decl, bb),
- bb->loop_depth);
+ if (is_gimple_call (stmt))
+ {
+ int freq = compute_call_stmt_bb_frequency (current_function_decl,
+ bb);
+ decl = gimple_call_fndecl (stmt);
+ if (decl)
+ cgraph_create_edge (node, cgraph_node (decl), stmt,
+ bb->count, freq,
+ bb->loop_depth);
+ else
+ cgraph_create_indirect_edge (node, stmt,
+ gimple_call_flags (stmt),
+ bb->count, freq,
+ bb->loop_depth);
+ }
walk_stmt_load_store_addr_ops (stmt, node, mark_load,
mark_store, mark_address);
if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
}
/* Look for initializers of constant variables and private statics. */
- for (step = cfun->local_decls;
- step;
- step = TREE_CHAIN (step))
- {
- tree decl = TREE_VALUE (step);
- if (TREE_CODE (decl) == VAR_DECL
- && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
- varpool_finalize_decl (decl);
- }
+ FOR_EACH_LOCAL_DECL (cfun, ix, decl)
+ if (TREE_CODE (decl) == VAR_DECL
+ && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
+ varpool_finalize_decl (decl);
record_eh_tables (node, cfun);
pointer_set_destroy (visited_nodes);
gimple stmt = gsi_stmt (gsi);
tree decl;
- if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt)))
- cgraph_create_edge (node, cgraph_node (decl), stmt,
- bb->count,
- compute_call_stmt_bb_frequency
- (current_function_decl, bb),
- bb->loop_depth);
+ if (is_gimple_call (stmt))
+ {
+ int freq = compute_call_stmt_bb_frequency (current_function_decl,
+ bb);
+ decl = gimple_call_fndecl (stmt);
+ if (decl)
+ cgraph_create_edge (node, cgraph_node (decl), stmt,
+ bb->count, freq,
+ bb->loop_depth);
+ else
+ cgraph_create_indirect_edge (node, stmt,
+ gimple_call_flags (stmt),
+ bb->count, freq,
+ bb->loop_depth);
+ }
walk_stmt_load_store_addr_ops (stmt, node, mark_load,
mark_store, mark_address);