[tree-ssa]: PATCH: hookize profiling

Jan Hubicka hubicka@ucw.cz
Thu Feb 12 10:30:00 GMT 2004


> On Feb 11, 2004, at 3:28 PM, Jan Hubicka wrote:
> >>  /* Initialization of functions specific to the rtl IR.  */
> >>*************** void
> >>*** 45,50 ****
> >>--- 48,55 ----
> >>  cfg_layout_rtl_register_cfg_hooks (void)
> >>  {
> >>    cfg_hooks = &cfg_layout_rtl_cfg_hooks;
> >>+   rtl_register_value_prof_hooks ();
> >>+   rtl_register_profile_hooks ();
> >
> >If we move into multiple CFGs at a time, we will have each CFG object 
> >to
> >have local copy of hook pointers, so I would rather not add new ones.
> >I think it would be better to simply register these hooks just before
> >profiling code is called in rest_of_handle_* and branch_prob.
> 
> I thought about this, the trouble is that the profiling code calls into 
> the
> CFG manipulation code in a number of places, and that is sensitive
> to the setting of the cfg_hooks.  (It also references ir_type directly,

Yes, you need to have right set of hooks depending on IR type you are
operating on.  Since profiling code is called just from two places (and
we should not need to add more entry points), I don't quite see how it
can bring problems.  In the case we want to keep the modules at least
partly separated, I would preffer instrumentation code to use CFG API,
but not vice versa.

We can just invent rtl_register_hooks, cfg_register_hooks that will call
all three functions, but I don't see how much it will buy us and it will
make it neccesary to store all three pointers in the CFG structure.
Also the CFG expansion code is switching the hooks back and forth so it
is better to not make it more expensive.  (but none of these is big deal
either, so if you see some stronger argument other way, just tell :)

Honza
> at the moment, though that could be changed.)  I really think it's
> asking for trouble right now to allow the hooks to be called at
> different times.



More information about the Gcc-patches mailing list