summaryrefslogtreecommitdiff
path: root/gcc/tree-profile.c
diff options
context:
space:
mode:
authorxur <xur@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-07 04:06:12 +0000
committerxur <xur@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-07 04:06:12 +0000
commitb74245ec69a1273ff362da2bbba6810ef45bc045 (patch)
tree3f660889ad3bf100d6e658c24a2f620b8f2c0414 /gcc/tree-profile.c
parent8ceaa1efdd692f5d0774ddcc2b46ed9c610bfa94 (diff)
downloadgcc-b74245ec69a1273ff362da2bbba6810ef45bc045.tar.gz
2014-10-06 Rong Xu <xur@google.com>
* gcc/params.def (PARAM_INDIR_CALL_TOPN_PROFILE): New param. * gcc/tree-profile.c: (params.h): New include. (init_ic_make_global_vars): Make __gcov_indirect_call_topn_callee and __gcov_indirect_call_topn_counters for indirect_call_topn_profile. (gimple_init_edge_profiler): New decls for __gcov_indirect_call_topn_profiler. (gimple_gen_ic_profiler): Generate the correct profiler call. (gimple_gen_ic_func_profiler): Fix format. * gcc/value-prof.c (params.h): New include. (dump_histogram_value): Hanlde indirect_call_topn counters. (stream_in_histogram_value): Ditto. (gimple_indirect_call_to_profile): Use indirect_call_topn profile when PARAM_INDIR_CALL_TOPN_PROFILE is set. (gimple_find_values_to_profile): Hanlde indirect_call_topn counters. * gcc/value-prof.h (enum hist_type): Histrogram type for indirect_call_topn counters. * gcc/profile.c (instrument_values): Instrument indirect_call_topn counters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215963 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-profile.c')
-rw-r--r--gcc/tree-profile.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index ba90196c7ce..48d13a22d34 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "tree-cfgcleanup.h"
#include "tree-nested.h"
+#include "params.h"
static GTY(()) tree gcov_type_node;
static GTY(()) tree tree_interval_profiler_fn;
@@ -101,7 +102,10 @@ init_ic_make_global_vars (void)
{
ic_void_ptr_var
= build_decl (UNKNOWN_LOCATION, VAR_DECL,
- get_identifier ("__gcov_indirect_call_callee"),
+ get_identifier (
+ (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) ?
+ "__gcov_indirect_call_topn_callee" :
+ "__gcov_indirect_call_callee")),
ptr_void);
TREE_PUBLIC (ic_void_ptr_var) = 1;
DECL_EXTERNAL (ic_void_ptr_var) = 1;
@@ -131,7 +135,10 @@ init_ic_make_global_vars (void)
{
ic_gcov_type_ptr_var
= build_decl (UNKNOWN_LOCATION, VAR_DECL,
- get_identifier ("__gcov_indirect_call_counters"),
+ get_identifier (
+ (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) ?
+ "__gcov_indirect_call_topn_counters" :
+ "__gcov_indirect_call_counters")),
gcov_type_ptr);
TREE_PUBLIC (ic_gcov_type_ptr_var) = 1;
DECL_EXTERNAL (ic_gcov_type_ptr_var) = 1;
@@ -226,8 +233,10 @@ gimple_init_edge_profiler (void)
ptr_void,
NULL_TREE);
tree_indirect_call_profiler_fn
- = build_fn_decl ("__gcov_indirect_call_profiler_v2",
- ic_profiler_fn_type);
+ = build_fn_decl ( (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) ?
+ "__gcov_indirect_call_topn_profiler":
+ "__gcov_indirect_call_profiler_v2"),
+ ic_profiler_fn_type);
}
TREE_NOTHROW (tree_indirect_call_profiler_fn) = 1;
DECL_ATTRIBUTES (tree_indirect_call_profiler_fn)
@@ -398,6 +407,12 @@ gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
tree ref_ptr = tree_coverage_counter_addr (tag, base);
+ if ( (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) &&
+ tag == GCOV_COUNTER_V_INDIR) ||
+ (!PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE) &&
+ tag == GCOV_COUNTER_ICALL_TOPNV))
+ return;
+
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr,
true, NULL_TREE, true, GSI_SAME_STMT);
@@ -442,8 +457,7 @@ gimple_gen_ic_func_profiler (void)
stmt1: __gcov_indirect_call_profiler_v2 (profile_id,
&current_function_decl)
*/
- gsi =
- gsi_after_labels (split_edge (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))));
+ gsi = gsi_after_labels (split_edge (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))));
cur_func = force_gimple_operand_gsi (&gsi,
build_addr (current_function_decl,