new-regalloc.c patch

Denis Chertykov denisc@overta.ru
Sat Feb 3 11:24:00 GMT 2001


Geert Bosch <bosch@gnat.com> writes:

> This definately gets me further in my quest to bootstrap on x86 :-)
> 
>   -Geert
> 
> On 3 Feb 2001, Denis Chertykov wrote:
> |So, `edge_weight' is:
> |
> |/* Determine the edge weight from reg v1 to reg v2.  */
> |static int
> |edge_weight (v1, v2)
> |     unsigned int v1;
> |     unsigned int v2;
> |{
> |  int w1 = 1, w2 = 1;
> |
> |  if (! REGNO_REG_SET_P (precolored, v1))
> |    w1 = CLASS_MAX_NREGS (reg_preferred_class (v1), PSEUDO_REGNO_MODE (v1));
> |  if (! REGNO_REG_SET_P (precolored, v2))
> |    w2 = CLASS_MAX_NREGS (reg_preferred_class (v2), PSEUDO_REGNO_MODE (v2));
> |
> |  return MAX(w2,w1);
> |}

Try following version.

/* Determine the edge weight from reg v1 to reg v2.  */
static int
edge_weight (v1, v2)
     unsigned int v1;
     unsigned int v2;
{
  int w1 = 1, w2 = 1;

  if (! REGNO_REG_SET_P (precolored, v1))
    w1 = CLASS_MAX_NREGS (reg_preferred_class (v1), PSEUDO_REGNO_MODE (v1));
  if (! REGNO_REG_SET_P (precolored, v2))
    w2 = CLASS_MAX_NREGS (reg_preferred_class (v2), PSEUDO_REGNO_MODE (v2));

  return w2;
}



More information about the Gcc-patches mailing list