This is the mail archive of the
mailing list for the GCC project.
Sharing stack slots
- To: gcc at gcc dot gnu dot org
- Subject: Sharing stack slots
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Tue, 9 Oct 01 16:41:29 EDT
We have a lot of code to do it, but I'm wondering if we really should.
There's a kludge in expr.c which says:
/* If the address of the structure varies, then it might be on
the stack. And, stack slots may be shared across scopes.
So, two different structures, of different types, can end up
at the same location. We will give the structures alias set
zero; here we must be careful not to give non-zero alias sets
to their fields. */
That's a real efficiency hit.
Moreover, one of the ideas behind the MEM tracking I'm doing is to record
which decl a MEM is for with the idea that if two MEMs are in different
decls, we they can't alias one another. But, of course, they can if they
are in different scopes and have overlapped each other. But this is
an important optimization, and I'm told particularly important on IA64.
On the other hand, overlapping large objects that are in blocks of
different scope are also quite important, especially in code
that's generated by some program (and somewhat in Ada expanded code).
We've been playing around with this compromise for a while, but I think we
need to deal with it in a less ad-hoc manner now.