Allow cgraph nodes to change name

Jan Hubicka hubicka@ucw.cz
Wed Aug 20 09:14:00 GMT 2003


> Geoff Keating <geoffk@geoffk.org> writes:
> 
> >> > I think a better approach would be to ensure that function's assembler
> >> > names are set exactly once, rather than being set (to the wrong value)
> >> > and then changed later.  I fixed a bunch of places where this was done
> >> > recently, and so far as I know this is the last place.
> >> 
> >> It may be also possible to simply produce RTL name before we insert the
> >> node, but I was under impression that for C++ it is expensive to produce
> >> it and that is why we do so lazily on demand.
> >
> > This won't work if the RTL name is wrong.  The problem here is that
> > even in C, when you have
> >
> > extern void foo (void) asm ("bar");
> >
> > then DECL_ASSEMBLER_NAME starts off by being set to "foo", and then
> > later is changed to "bar".  Naturally, this confuses the cgraph code
> > (and intermodule analysis, and weak symbols, and everywhere else that
> > tries to look at the assembler name).
> 
> Probably the best solution is to generate DECL_ASSEMBLER_NAME
> extremely lazily or else when forcibly set, as is currently done for
> DECL_RTL.
> 
> I suspect this works better if unit-at-a-time mode is always on.

In unit-at-a-time mode I use DECL_ASSEMBLER_NAME at the time function is
inserted into the database that usually happens at first reference or
definition of it, so it is not lazy enought.

Another alternative is that in fact I don't need the hashtables.
Only what I use it for is to convert DECL nodes into cgraph nodes.  The
problem is that cgraph nodes are unique for function while DECL nodes
are not, but perhaps frontends already have some capability of tracking
this down.  Do you think it would be possible to add a direct pointer
into the nodes and track it down using it?

Honza
> 
> zw



More information about the Gcc-patches mailing list