Better estimations of costs in outof-ssa
Andrew MacLeod
amacleod@redhat.com
Sat Jul 30 02:55:00 GMT 2005
On Fri, 2005-07-29 at 17:21, Jan Hubicka wrote:
> > On Thu, Jul 28, 2005 at 09:22:27AM +0200, Jan Hubicka wrote:
> > > ! {
> > > ! /* Base costs on BB frequencies bounded by 1. */
> > > ! int cost = EDGE_FREQUENCY (PHI_ARG_EDGE (phi, x));
> > > !
> > > ! if (!cost)
> > > ! cost = 1;
> > > ! if (optimize_size || !maybe_hot_bb_p (bb))
> > > ! cost = 1;
> > > ! /* Inserting copy on critical edge is more costy
> > > ! than inserting it elsewhere. */
> > > ! if (EDGE_CRITICAL_P (PHI_ARG_EDGE (phi, x)))
> > > ! cost *= 2;
> > > ! add_coalesce (cl, p, p2, cost);
> >
> > Please factor out this thrice duplicated code.
>
> OK, this moves the cost computation into add_coalesce itself.
> It seems dificult to merge this somewhat further with other places we
> compute simlar costs (such as reg-alloc) because of stubble differences
> in between these..
Ick. Why should add_coalesce have to know or care about hot blocks and
critical edges? It is intended to just take a simple cost.
I would prefer to see the costs calculated by another small function or
macro. If I want to use add_coalesce for another purpose now (and
coalesce lists are generic), I will have to write another add_coalesce,
or create dummy values for those parameters I don't care about, and have
to figure out what the correct dummy values are.
Andrew
More information about the Gcc-patches
mailing list