/* Callgraph construction.
- Copyright (C) 2003-2017 Free Software Foundation, Inc.
+ Copyright (C) 2003-2019 Free Software Foundation, Inc.
Contributed by Jan Hubicka
This file is part of GCC.
int
compute_call_stmt_bb_frequency (tree decl, basic_block bb)
{
- int entry_freq = ENTRY_BLOCK_PTR_FOR_FN
- (DECL_STRUCT_FUNCTION (decl))->frequency;
- int freq = bb->frequency;
-
- if (profile_status_for_fn (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT)
- return CGRAPH_FREQ_BASE;
-
- if (!entry_freq)
- entry_freq = 1, freq++;
-
- freq = freq * CGRAPH_FREQ_BASE / entry_freq;
- if (freq > CGRAPH_FREQ_MAX)
- freq = CGRAPH_FREQ_MAX;
-
- return freq;
+ return bb->count.to_cgraph_frequency
+ (ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count);
}
/* Mark address taken in STMT. */
if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
{
- int freq = compute_call_stmt_bb_frequency (current_function_decl,
- bb);
decl = gimple_call_fndecl (call_stmt);
if (decl)
- node->create_edge (cgraph_node::get_create (decl), call_stmt, bb->count, freq);
+ node->create_edge (cgraph_node::get_create (decl), call_stmt, bb->count);
else if (gimple_call_internal_p (call_stmt))
;
else
node->create_indirect_edge (call_stmt,
gimple_call_flags (call_stmt),
- bb->count, freq);
+ bb->count);
}
node->record_stmt_references (stmt);
if (gomp_parallel *omp_par_stmt = dyn_cast <gomp_parallel *> (stmt))
if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
{
- int freq = compute_call_stmt_bb_frequency (current_function_decl,
- bb);
decl = gimple_call_fndecl (call_stmt);
if (decl)
node->create_edge (cgraph_node::get_create (decl), call_stmt,
- bb->count, freq);
+ bb->count);
else if (gimple_call_internal_p (call_stmt))
;
else
node->create_indirect_edge (call_stmt,
gimple_call_flags (call_stmt),
- bb->count, freq);
+ bb->count);
}
node->record_stmt_references (stmt);
}
}
record_eh_tables (node, cfun);
gcc_assert (!node->global.inlined_to);
-
- if (node->instrumented_version
- && !node->instrumentation_clone)
- node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL);
-
return 0;
}
node->record_stmt_references (gsi_stmt (gsi));
}
record_eh_tables (node, cfun);
-
- if (node->instrumented_version
- && !node->instrumentation_clone)
- node->create_reference (node->instrumented_version, IPA_REF_CHKP, NULL);
}
namespace {