New register allocator
Geoff Keating
geoffk@geoffk.org
Tue Jul 9 16:02:00 GMT 2002
> Date: Tue, 9 Jul 2002 23:05:03 +0200 (CEST)
> From: Michael Matz <matz@suse.de>
> Cc: <gcc-patches@gcc.gnu.org>
>
> Hi Geoff,
>
> I'm back, so:
>
> On Wed, 3 Jul 2002, Geoff Keating wrote:
>
> > wanted reviewed and would commit. I looked at:
> >
> > <http://user.cs.tu-berlin.de/~matzmich/ra/ra_all.diff.gz>
>
> That's the correct one. Besides the changes to one .texi file equal to
> what I send you directly.
Did you post that? There are others on gcc-patches that are better
than I at reviewing documentation patches...
> I addressed your comments, except the below to which I've questions:
>
> > - Please don't add any new invocations of ggc_add_root or
> > ggc_mark_rtx. Both these routines are obsolete and will be deleted
> > Real Soon Now. Use GTY markers instead.
>
> Hmm. But the one place where I need a new root, the exact content of the
> variable is only created dynamically. Does it still work for a static
> variable that is used in this way? (I believe Mark once had a similar
> problem a few weeks ago). I.e. I create a "template" insn into a static
> var (originally initialized to NULL_RTX), which I then reuse for the rest
> of the compile run, only slightly changing it each time, to not have to
> reconstruct it again and again. I.e. basically this pattern:
>
> void bla() {
> static ptr the_var = 0;
> if (!the_var)
> the_var = init_me ();
> }
>
> Can I simply mark the_var with GTY() and it works as expected?
Yes, so long as it's globally visible, that is you have to say
static GTY(()) rtx the_var;
void bla()
{
if (the_var == NULL)
the_var = ...
...
}
There are lots of examples in GCC's source code of how to do this, for
instance, look at lookup_cl in java/parse.y.
It doesn't matter that sometimes the_var is NULL. The GC code knows
about NULL pointers.
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
More information about the Gcc-patches
mailing list