public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ra-colorize.c:1068: `inv_reg_alloc_order' undeclared
@ 2002-07-24 16:05 John David Anglin
  2002-07-24 20:27 ` [fix] for: " Michael Matz
  0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2002-07-24 16:05 UTC (permalink / raw)
  To: gcc

The following error occurs building a vax-ultrix cross:

gcc -c -DIN_GCC -DCROSS_COMPILE   -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/config -I../../gcc/gcc/../include ../../gcc/gcc/ra-colorize.c -o ra-colorize.o
../../gcc/gcc/ra-colorize.c: In function `get_free_reg':
../../gcc/gcc/ra-colorize.c:1068: `inv_reg_alloc_order' undeclared (first use in this function)
../../gcc/gcc/ra-colorize.c:1068: (Each undeclared identifier is reported only once

The error occurs because inv_reg_alloc_order is only defined when
REG_ALLOC_ORDER is defined.  None of the vax ports define this macro.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [fix] for: ra-colorize.c:1068: `inv_reg_alloc_order' undeclared
  2002-07-24 16:05 ra-colorize.c:1068: `inv_reg_alloc_order' undeclared John David Anglin
@ 2002-07-24 20:27 ` Michael Matz
  2002-07-24 21:48   ` John David Anglin
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Matz @ 2002-07-24 20:27 UTC (permalink / raw)
  To: John David Anglin; +Cc: gcc, gcc-patches

Hi,

On Wed, 24 Jul 2002, John David Anglin wrote:

> The error occurs because inv_reg_alloc_order is only defined when
> REG_ALLOC_ORDER is defined.  None of the vax ports define this macro.

Fixed thusly (will checkin after bootstrap/regtest):


Ciao,
Michael.
-- 
        * ra-colorize.c (inv_reg_alloc_order): New macro.
        (free_reg): Use it.

Index: ra-colorize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-colorize.c,v
retrieving revision 1.2
diff -u -p -r1.2 ra-colorize.c
--- ra-colorize.c	15 Jul 2002 14:07:05 -0000	1.2
+++ ra-colorize.c	24 Jul 2002 20:09:14 -0000
@@ -1031,6 +1031,13 @@ color_usable_p (c, dont_begin_colors, fr
   return 0;
 }

+/* I don't want to clutter up the actual code with ifdef's.  */
+#ifdef REG_ALLOC_ORDER
+#define inv_reg_alloc_order(c) inv_reg_alloc_order[c]
+#else
+#define inv_reg_alloc_order(c) c
+#endif
+
 /* Searches in FREE_COLORS for a block of hardregs of the right length
    for MODE, which doesn't begin at a hardreg mentioned in DONT_BEGIN_COLORS.
    If it needs more than one hardreg it prefers blocks beginning
@@ -1065,16 +1072,16 @@ get_free_reg (dont_begin_colors, free_co
 	  {
 	    if (size < 2 || (c & 1) == 0)
 	      {
-		if (inv_reg_alloc_order[c] < pref_reg_order)
+		if (inv_reg_alloc_order (c) < pref_reg_order)
 		  {
 		    pref_reg = c;
-		    pref_reg_order = inv_reg_alloc_order[c];
+		    pref_reg_order = inv_reg_alloc_order (c);
 		  }
 	      }
-	    else if (inv_reg_alloc_order[c] < last_resort_reg_order)
+	    else if (inv_reg_alloc_order (c) < last_resort_reg_order)
 	      {
 		last_resort_reg = c;
-		last_resort_reg_order = inv_reg_alloc_order[c];
+		last_resort_reg_order = inv_reg_alloc_order (c);
 	      }
 	  }
 	else

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fix] for: ra-colorize.c:1068: `inv_reg_alloc_order' undeclared
  2002-07-24 20:27 ` [fix] for: " Michael Matz
@ 2002-07-24 21:48   ` John David Anglin
  2002-07-24 22:44     ` Michael Matz
  0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2002-07-24 21:48 UTC (permalink / raw)
  To: Michael Matz; +Cc: gcc, gcc-patches

> +/* I don't want to clutter up the actual code with ifdef's.  */
> +#ifdef REG_ALLOC_ORDER
> +#define inv_reg_alloc_order(c) inv_reg_alloc_order[c]
> +#else
> +#define inv_reg_alloc_order(c) c

Should the above be

#define inv_reg_alloc_order(c) FIRST_PSEUDO_REGISTER - 1 - (c)

to obtain the inverse of lowest to highest ordering?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fix] for: ra-colorize.c:1068: `inv_reg_alloc_order' undeclared
  2002-07-24 21:48   ` John David Anglin
@ 2002-07-24 22:44     ` Michael Matz
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Matz @ 2002-07-24 22:44 UTC (permalink / raw)
  To: John David Anglin; +Cc: gcc, gcc-patches

Hi,

On Wed, 24 Jul 2002, John David Anglin wrote:

> > +/* I don't want to clutter up the actual code with ifdef's.  */
> > +#ifdef REG_ALLOC_ORDER
> > +#define inv_reg_alloc_order(c) inv_reg_alloc_order[c]
> > +#else
> > +#define inv_reg_alloc_order(c) c
>
> Should the above be
>
> #define inv_reg_alloc_order(c) FIRST_PSEUDO_REGISTER - 1 - (c)
>
> to obtain the inverse of lowest to highest ordering?

No, it's not inverse ordering, but inverse mapping, so that
inv_order[order[i]] == i.  As this platform doesn't define REG_ALLOC_ORDER
it makes sense to begin allocating from the beginning, i.e. order[i]==i.
Ergo we have inv_order[order[i]] == inv_order[i] == i ;-)


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-07-24 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-24 16:05 ra-colorize.c:1068: `inv_reg_alloc_order' undeclared John David Anglin
2002-07-24 20:27 ` [fix] for: " Michael Matz
2002-07-24 21:48   ` John David Anglin
2002-07-24 22:44     ` Michael Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).