Index: value-prof.c
===================================================================
--- value-prof.c	(revision 168119)
+++ value-prof.c	(working copy)
@@ -47,8 +47,6 @@ along with GCC; see the file COPYING3.
 #include "tree-pass.h"
 #include "pointer-set.h"
 
-static struct value_prof_hooks *value_prof_hooks;
-
 /* In this file value profile based optimizations are placed.  Currently the
    following optimizations are implemented (for more detailed descriptions
    see comments at value_profile_transformations):
@@ -488,7 +486,7 @@ check_counter (gimple stmt, const char *
 
 /* GIMPLE based transformations. */
 
-static bool
+bool
 gimple_value_profile_transformations (void)
 {
   basic_block bb;
@@ -1545,14 +1543,6 @@ stringop_block_profile (gimple stmt, uns
     }
 }
 
-struct value_prof_hooks {
-  /* Find list of values for which we want to measure histograms.  */
-  void (*find_values_to_profile) (histogram_values *);
-
-  /* Identify and exploit properties of values that are hard to analyze
-     statically.  See value-prof.c for more detail.  */
-  bool (*value_profile_transformations) (void);
-};
 
 /* Find values inside STMT for that we want to measure histograms for
    division/modulo optimization.  */
@@ -1686,7 +1676,7 @@ gimple_values_to_profile (gimple stmt, h
     }
 }
 
-static void
+void
 gimple_find_values_to_profile (histogram_values *values)
 {
   basic_block bb;
@@ -1743,28 +1733,3 @@ gimple_find_values_to_profile (histogram
     }
 }
 
-static struct value_prof_hooks gimple_value_prof_hooks = {
-  gimple_find_values_to_profile,
-  gimple_value_profile_transformations
-};
-
-void
-gimple_register_value_prof_hooks (void)
-{
-  gcc_assert (current_ir_type () == IR_GIMPLE);
-  value_prof_hooks = &gimple_value_prof_hooks;
-}
-
-/* IR-independent entry points.  */
-void
-find_values_to_profile (histogram_values *values)
-{
-  (value_prof_hooks->find_values_to_profile) (values);
-}
-
-bool
-value_profile_transformations (void)
-{
-  return (value_prof_hooks->value_profile_transformations) ();
-}
-
Index: value-prof.h
===================================================================
--- value-prof.h	(revision 168119)
+++ value-prof.h	(working copy)
@@ -40,6 +40,7 @@ enum hist_type
 #define HIST_TYPE_FOR_COUNTER(COUNTER) \
   ((enum hist_type) ((COUNTER) - GCOV_FIRST_VALUE_COUNTER))
 
+
 /* The value to measure.  */
 struct histogram_value_t
 {
@@ -70,44 +71,8 @@ DEF_VEC_ALLOC_P(histogram_value,heap);
 
 typedef VEC(histogram_value,heap) *histogram_values;
 
-/* Hooks registration.  */
-extern void gimple_register_value_prof_hooks (void);
-
-/* IR-independent entry points.  */
-extern void find_values_to_profile (histogram_values *);
-extern bool value_profile_transformations (void);
-
-/* External declarations for edge-based profiling.  */
-struct profile_hooks {
-
-  /* Insert code to initialize edge profiler.  */
-  void (*init_edge_profiler) (void);
-
-  /* Insert code to increment an edge count.  */
-  void (*gen_edge_profiler) (int, edge);
-
-  /* Insert code to increment the interval histogram counter.  */
-  void (*gen_interval_profiler) (histogram_value, unsigned, unsigned);
-
-  /* Insert code to increment the power of two histogram counter.  */
-  void (*gen_pow2_profiler) (histogram_value, unsigned, unsigned);
-
-  /* Insert code to find the most common value.  */
-  void (*gen_one_value_profiler) (histogram_value, unsigned, unsigned);
-
-  /* Insert code to find the most common value of a difference between two
-     evaluations of an expression.  */
-  void (*gen_const_delta_profiler) (histogram_value, unsigned, unsigned);
-
-  /* Insert code to find the most common indirect call */
-  void (*gen_ic_profiler) (histogram_value, unsigned, unsigned);
-
-  /* Insert code to find the average value of an expression.  */
-  void (*gen_average_profiler) (histogram_value, unsigned, unsigned);
-
-  /* Insert code to ior value of an expression.  */
-  void (*gen_ior_profiler) (histogram_value, unsigned, unsigned);
-};
+extern void gimple_find_values_to_profile (histogram_values *);
+extern bool gimple_value_profile_transformations (void);
 
 histogram_value gimple_histogram_value (struct function *, gimple);
 histogram_value gimple_histogram_value_of_type (struct function *, gimple,
@@ -123,14 +88,23 @@ void verify_histograms (void);
 void free_histograms (void);
 void stringop_block_profile (gimple, unsigned int *, HOST_WIDE_INT *);
 
+/* In tree-profile.c.  */
+extern void gimple_init_edge_profiler (void);
+extern void gimple_gen_edge_profiler (int, edge);
+extern void gimple_gen_interval_profiler (histogram_value, unsigned, unsigned);
+extern void gimple_gen_pow2_profiler (histogram_value, unsigned, unsigned);
+extern void gimple_gen_one_value_profiler (histogram_value, unsigned, unsigned);
+extern void gimple_gen_ic_profiler (histogram_value, unsigned, unsigned);
+extern void gimple_gen_ic_func_profiler (void);
+extern void gimple_gen_const_delta_profiler (histogram_value,
+					     unsigned, unsigned);
+extern void gimple_gen_average_profiler (histogram_value, unsigned, unsigned);
+extern void gimple_gen_ior_profiler (histogram_value, unsigned, unsigned);
+
 /* In profile.c.  */
 extern void init_branch_prob (void);
 extern void branch_prob (void);
 extern void end_branch_prob (void);
-extern void tree_register_profile_hooks (void);
-
-/* In tree-profile.c.  */
-extern struct profile_hooks tree_profile_hooks;
 
 #endif	/* GCC_VALUE_PROF_H */
 
Index: profile.c
===================================================================
--- profile.c	(revision 168119)
+++ profile.c	(working copy)
@@ -72,9 +72,6 @@ along with GCC; see the file COPYING3.
 
 #include "profile.h"
 
-/* Hooks for profiling.  */
-static struct profile_hooks* profile_hooks;
-
 struct bb_info {
   unsigned int count_valid : 1;
 
@@ -141,7 +138,7 @@ instrument_edges (struct edge_list *el)
 		fprintf (dump_file, "Edge %d to %d instrumented%s\n",
 			 e->src->index, e->dest->index,
 			 EDGE_CRITICAL_P (e) ? " (and split)" : "");
-	      (profile_hooks->gen_edge_profiler) (num_instr_edges++, e);
+	      gimple_gen_edge_profiler (num_instr_edges++, e);
 	    }
 	}
     }
@@ -202,31 +199,31 @@ instrument_values (histogram_values valu
       switch (hist->type)
 	{
 	case HIST_TYPE_INTERVAL:
-	  (profile_hooks->gen_interval_profiler) (hist, t, 0);
+	  gimple_gen_interval_profiler (hist, t, 0);
 	  break;
 
 	case HIST_TYPE_POW2:
-	  (profile_hooks->gen_pow2_profiler) (hist, t, 0);
+	  gimple_gen_pow2_profiler (hist, t, 0);
 	  break;
 
 	case HIST_TYPE_SINGLE_VALUE:
-	  (profile_hooks->gen_one_value_profiler) (hist, t, 0);
+	  gimple_gen_one_value_profiler (hist, t, 0);
 	  break;
 
 	case HIST_TYPE_CONST_DELTA:
-	  (profile_hooks->gen_const_delta_profiler) (hist, t, 0);
+	  gimple_gen_const_delta_profiler (hist, t, 0);
 	  break;
 
  	case HIST_TYPE_INDIR_CALL:
- 	  (profile_hooks->gen_ic_profiler) (hist, t, 0);
+ 	  gimple_gen_ic_profiler (hist, t, 0);
   	  break;
 
 	case HIST_TYPE_AVERAGE:
-	  (profile_hooks->gen_average_profiler) (hist, t, 0);
+	  gimple_gen_average_profiler (hist, t, 0);
 	  break;
 
 	case HIST_TYPE_IOR:
-	  (profile_hooks->gen_ior_profiler) (hist, t, 0);
+	  gimple_gen_ior_profiler (hist, t, 0);
 	  break;
 
 	default:
@@ -1170,7 +1167,7 @@ branch_prob (void)
 #undef BB_TO_GCOV_INDEX
 
   if (flag_profile_values)
-    find_values_to_profile (&values);
+    gimple_find_values_to_profile (&values);
 
   if (flag_branch_probabilities)
     {
@@ -1187,7 +1184,7 @@ branch_prob (void)
     {
       unsigned n_instrumented;
 
-      profile_hooks->init_edge_profiler ();
+      gimple_init_edge_profiler ();
 
       n_instrumented = instrument_edges (el);
 
@@ -1372,11 +1369,3 @@ end_branch_prob (void)
     }
 }
 
-/* Set up hooks to enable tree-based profiling.  */
-
-void
-tree_register_profile_hooks (void)
-{
-  gcc_assert (current_ir_type () == IR_GIMPLE);
-  profile_hooks = &tree_profile_hooks;
-}
Index: tree-profile.c
===================================================================
--- tree-profile.c	(revision 168119)
+++ tree-profile.c	(working copy)
@@ -65,7 +65,7 @@ static GTY(()) tree ptr_void;
    static void*	__gcov_indirect_call_callee; // actual callee address
 */
 static void
-tree_init_ic_make_global_vars (void)
+init_ic_make_global_vars (void)
 {
   tree  gcov_type_ptr;
 
@@ -95,8 +95,8 @@ tree_init_ic_make_global_vars (void)
   varpool_mark_needed_node (varpool_node (ic_gcov_type_ptr_var));
 }
 
-static void
-tree_init_edge_profiler (void)
+void
+gimple_init_edge_profiler (void)
 {
   tree interval_profiler_fn_type;
   tree pow2_profiler_fn_type;
@@ -149,7 +149,7 @@ tree_init_edge_profiler (void)
 	= tree_cons (get_identifier ("leaf"), NULL,
 		     DECL_ATTRIBUTES (tree_one_value_profiler_fn));
 
-      tree_init_ic_make_global_vars ();
+      init_ic_make_global_vars ();
 
       /* void (*) (gcov_type *, gcov_type, void *, void *)  */
       ic_profiler_fn_type
@@ -199,8 +199,8 @@ tree_init_edge_profiler (void)
    execution count, and insert them on E.  We rely on
    gsi_insert_on_edge to preserve the order.  */
 
-static void
-tree_gen_edge_profiler (int edgeno, edge e)
+void
+gimple_gen_edge_profiler (int edgeno, edge e)
 {
   tree ref, one;
   gimple stmt1, stmt2, stmt3;
@@ -239,8 +239,8 @@ prepare_instrumented_value (gimple_stmt_
    counter.  VALUE is the expression whose value is profiled.  TAG is the
    tag of the section for counters, BASE is offset of the counter position.  */
 
-static void
-tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
+void
+gimple_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   gimple stmt = value->hvalue.stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -265,8 +265,8 @@ tree_gen_interval_profiler (histogram_va
    counter.  VALUE is the expression whose value is profiled.  TAG is the tag
    of the section for counters, BASE is offset of the counter position.  */
 
-static void
-tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
+void
+gimple_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   gimple stmt = value->hvalue.stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -285,8 +285,8 @@ tree_gen_pow2_profiler (histogram_value
    VALUE is the expression whose value is profiled.  TAG is the tag of the
    section for counters, BASE is offset of the counter position.  */
 
-static void
-tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
+void
+gimple_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   gimple stmt = value->hvalue.stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -308,8 +308,8 @@ tree_gen_one_value_profiler (histogram_v
    TAG is the tag of the section for counters, BASE is offset of the
    counter position.  */
 
-static void
-tree_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
+void
+gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   tree tmp1;
   gimple stmt1, stmt2, stmt3;
@@ -343,8 +343,8 @@ tree_gen_ic_profiler (histogram_value va
    beginning of every possible called function.
   */
 
-static void
-tree_gen_ic_func_profiler (void)
+void
+gimple_gen_ic_func_profiler (void)
 {
   struct cgraph_node * c_node = cgraph_node (current_function_decl);
   gimple_stmt_iterator gsi;
@@ -354,7 +354,7 @@ tree_gen_ic_func_profiler (void)
   if (cgraph_only_called_directly_p (c_node))
     return;
 
-  tree_init_edge_profiler ();
+  gimple_init_edge_profiler ();
 
   gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR));
 
@@ -387,8 +387,8 @@ tree_gen_ic_func_profiler (void)
    VALUE is the expression whose value is profiled.  TAG is the tag of the
    section for counters, BASE is offset of the counter position.  */
 
-static void
-tree_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED,
+void
+gimple_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED,
 			       unsigned tag ATTRIBUTE_UNUSED,
 			       unsigned base ATTRIBUTE_UNUSED)
 {
@@ -403,8 +403,8 @@ tree_gen_const_delta_profiler (histogram
    counter.  VALUE is the expression whose value is profiled.  TAG is the
    tag of the section for counters, BASE is offset of the counter position.  */
 
-static void
-tree_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
+void
+gimple_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   gimple stmt = value->hvalue.stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -424,8 +424,8 @@ tree_gen_average_profiler (histogram_val
    counter.  VALUE is the expression whose value is profiled.  TAG is the
    tag of the section for counters, BASE is offset of the counter position.  */
 
-static void
-tree_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
+void
+gimple_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
 {
   gimple stmt = value->hvalue.stmt;
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -454,9 +454,6 @@ tree_profiling (void)
   if (cgraph_state == CGRAPH_STATE_FINISHED)
     return 0;
 
-  tree_register_profile_hooks ();
-  gimple_register_value_prof_hooks ();
-
   for (node = cgraph_nodes; node; node = node->next)
     {
       if (!node->analyzed
@@ -479,12 +476,12 @@ tree_profiling (void)
 
       if (! flag_branch_probabilities
 	  && flag_profile_values)
-	tree_gen_ic_func_profiler ();
+	gimple_gen_ic_func_profiler ();
 
       if (flag_branch_probabilities
 	  && flag_profile_values
 	  && flag_value_profile_transformations)
-	value_profile_transformations ();
+	gimple_value_profile_transformations ();
 
       /* The above could hose dominator info.  Currently there is
 	 none coming in, this is a safety valve.  It should be
@@ -583,18 +580,4 @@ struct simple_ipa_opt_pass pass_ipa_tree
  }
 };
 
-
-struct profile_hooks tree_profile_hooks =
-{
-  tree_init_edge_profiler,       /* init_edge_profiler */
-  tree_gen_edge_profiler,	 /* gen_edge_profiler */
-  tree_gen_interval_profiler,    /* gen_interval_profiler */
-  tree_gen_pow2_profiler,        /* gen_pow2_profiler */
-  tree_gen_one_value_profiler,   /* gen_one_value_profiler */
-  tree_gen_const_delta_profiler, /* gen_const_delta_profiler */
-  tree_gen_ic_profiler,		 /* gen_ic_profiler */
-  tree_gen_average_profiler,     /* gen_average_profiler */
-  tree_gen_ior_profiler          /* gen_ior_profiler */
-};
-
 #include "gt-tree-profile.h"
