Commit f3df9541 by Andreas Krebbel Committed by Jan Hubicka

profile.c (branch_prob): Call to init_edge_profiler added.

	* profile.c (branch_prob): Call to init_edge_profiler added.
	* rtl-profile.c (rtl_init_edge_profiler): New function.
	(rtl_gen_edge_profiler): Replaced call to insert_insn_on_edge with
	call to safe_insert_insn_on_edge.
	(rtl_profile_hooks): rtl_init_edge_profiler added.
	* tree-profile.c (tree_init_edge_profiler): New function.
	(tree_profile_hooks): tree_init_edge_profiler added.
	* value-prof.h (profile_hooks) init_edge_profiler prototype added.

From-SVN: r89764
parent 86ce0e3d
2004-10-28 Andreas Krebbel <krebbel1@de.ibm.com>
* profile.c (branch_prob): Call to init_edge_profiler added.
* rtl-profile.c (rtl_init_edge_profiler): New function.
(rtl_gen_edge_profiler): Replaced call to insert_insn_on_edge with
call to safe_insert_insn_on_edge.
(rtl_profile_hooks): rtl_init_edge_profiler added.
* tree-profile.c (tree_init_edge_profiler): New function.
(tree_profile_hooks): tree_init_edge_profiler added.
* value-prof.h (profile_hooks) init_edge_profiler prototype added.
2004-10-28 Nick Clifton <nickc@redhat.com> 2004-10-28 Nick Clifton <nickc@redhat.com>
* config/iq2000/iq2000.c (iq2000_expand_epilogue): Use * config/iq2000/iq2000.c (iq2000_expand_epilogue): Use
......
...@@ -1095,7 +1095,11 @@ branch_prob (void) ...@@ -1095,7 +1095,11 @@ branch_prob (void)
if (profile_arc_flag if (profile_arc_flag
&& coverage_counter_alloc (GCOV_COUNTER_ARCS, num_instrumented)) && coverage_counter_alloc (GCOV_COUNTER_ARCS, num_instrumented))
{ {
unsigned n_instrumented = instrument_edges (el); unsigned n_instrumented;
profile_hooks->init_edge_profiler ();
n_instrumented = instrument_edges (el);
if (n_instrumented != num_instrumented) if (n_instrumented != num_instrumented)
abort (); abort ();
......
...@@ -64,6 +64,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -64,6 +64,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tree.h" #include "tree.h"
#include "ggc.h" #include "ggc.h"
/* Do initialization work for the edge profiler. */
static void
rtl_init_edge_profiler (void)
{
/* gen_edge_profiler calls safe_insert_insn_on_edge which needs
register liveness data to be available. */
life_analysis (NULL, 0);
}
/* Output instructions as RTL to increment the edge execution count. */ /* Output instructions as RTL to increment the edge execution count. */
static void static void
...@@ -85,7 +95,7 @@ rtl_gen_edge_profiler (int edgeno, edge e) ...@@ -85,7 +95,7 @@ rtl_gen_edge_profiler (int edgeno, edge e)
sequence = get_insns (); sequence = get_insns ();
end_sequence (); end_sequence ();
insert_insn_on_edge (sequence, e); safe_insert_insn_on_edge (sequence, e);
rebuild_jump_labels (e->insns.r); rebuild_jump_labels (e->insns.r);
} }
...@@ -413,6 +423,7 @@ static FILE *rtl_profile_dump_file (void) { ...@@ -413,6 +423,7 @@ static FILE *rtl_profile_dump_file (void) {
struct profile_hooks rtl_profile_hooks = struct profile_hooks rtl_profile_hooks =
{ {
rtl_init_edge_profiler,
rtl_gen_edge_profiler, rtl_gen_edge_profiler,
rtl_gen_interval_profiler, rtl_gen_interval_profiler,
rtl_gen_pow2_profiler, rtl_gen_pow2_profiler,
......
...@@ -69,6 +69,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -69,6 +69,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "value-prof.h" #include "value-prof.h"
/* Do initialization work for the edge profiler. */
static void
tree_init_edge_profiler (void)
{
}
/* Output instructions as GIMPLE trees to increment the edge /* Output instructions as GIMPLE trees to increment the edge
execution count, and insert them on E. We rely on execution count, and insert them on E. We rely on
bsi_insert_on_edge to preserve the order. */ bsi_insert_on_edge to preserve the order. */
...@@ -195,6 +203,7 @@ struct tree_opt_pass pass_tree_profile = ...@@ -195,6 +203,7 @@ struct tree_opt_pass pass_tree_profile =
struct profile_hooks tree_profile_hooks = struct profile_hooks tree_profile_hooks =
{ {
tree_init_edge_profiler, /* init_edge_profiler */
tree_gen_edge_profiler, /* gen_edge_profiler */ tree_gen_edge_profiler, /* gen_edge_profiler */
tree_gen_interval_profiler, /* gen_interval_profiler */ tree_gen_interval_profiler, /* gen_interval_profiler */
tree_gen_pow2_profiler, /* gen_pow2_profiler */ tree_gen_pow2_profiler, /* gen_pow2_profiler */
......
...@@ -80,6 +80,10 @@ extern bool value_profile_transformations (void); ...@@ -80,6 +80,10 @@ extern bool value_profile_transformations (void);
/* External declarations for edge-based profiling. */ /* External declarations for edge-based profiling. */
struct profile_hooks { struct profile_hooks {
/* Insert code to initialize edge profiler. */
void (*init_edge_profiler) (void);
/* Insert code to increment an edge count. */ /* Insert code to increment an edge count. */
void (*gen_edge_profiler) (int, edge); void (*gen_edge_profiler) (int, edge);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment