This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: new-regalloc.c patch


>
> Must I apply it ?
I'll take care of it.

>
> >
> > > 	(edge_weight): Weight of edge between v1 and v2 equal to hard
> > > 	regs count in v2.
> >
> > This is wrong.
> > The edge weight is dependent on the number of hard regs in both. The
> > reason i left out the other cases is because i couldn't figure them out in
> > my head, and they didn't seem to crop up.
> >
> > edge_weight (v1,v2) is directly dependent on how much v2 can block
> > coloring of v1, and v1 can block coloring of v2.
>
> v2 of v1 and v1 of v2 isn't the same.
yes it is, because v2 + v1 == v1 + v2.

>
> So,
> edge_weight (v1,v2) + edge_weight (v2,v1)
> == (CLASS_MAX_NREGS (reg_preferred_class (v1), PSEUDO_REGNO_MODE (v1)
>     + CLASS_MAX_NREGS (reg_preferred_class (v2), PSEUDO_REGNO_MODE (v2))

Not quite.
If each has two registers, you have a weight of two, not four.

>
> IE: For edge_weight (v1,v2): v2 can block
> CLASS_MAX_NREGS (regclass-v2, mode-of-v2) colors of v1.
>
> (IMHO: I can be wrong here, but I don't know where.)

From machsuif, who uses this method as well:
static int
edge_weight(var_node *n1, var_node *n2)
{
   int w1 = (n1->status == PRECOLORED ? 0 : regs_needed(n1));
   int w2 = (n2->status == PRECOLORED ? 0 : regs_needed(n2));

   switch(w1 + w2) {
     case 0:
     case 1:
     case 2: return 1;
     case 3: return 2;
     case 4: return (unaligned_pairs ? 3 : 2);
     default: assert(FALSE);
   }
   return -1;                   /* pacify compiler */
}


>
>
> > Think of edge weighting as an alternative to having multiple nodes, one
> > for each hard reg needed by the pseudo.
> > They would interfere with each other, and everything the pseudo interferes
> > with.
>
> My previous thought derived from "to having multiple nodes, one for
> each hard reg needed by the pseudo."
>
>
>    On some machines, double-precision values must be kept in even/odd
>    register pairs.  The way to implement that is to define this macro
>    to reject odd register numbers for such modes.
> --------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Wheee.

Let me double check that the change doesn't break anything for weird
reasons, and i'll check it in as well.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]