This is the mail archive of the
mailing list for the GCC project.
Re: function parms in regs, patch 3 of 3
- From: Jim Wilson <wilson at tuliptree dot org>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 02 May 2003 13:24:40 -0400
- Subject: Re: function parms in regs, patch 3 of 3
- References: <20030424153446.GZ1189@bubble.sa.bigpond.net.au><20030430132857.GJ25514@bubble.sa.bigpond.net.au><3EB1E09E.firstname.lastname@example.org> <20030502123830.GJ924@bubble.sa.bigpond.net.au>
On Fri, 2003-05-02 at 08:38, Alan Modra wrote:
> I like the idea. It would be nice if the called function could use
> the regs in a parallel without copying to the stack too, at least for
> simple cases.
In order to do this, we need some support for decomposing structures.
Currently, the only way to access a structure field is via an offset
from the base address for the structure. This requires that the
structure be in contiguous memory locations. In some simple cases, we
can handle structures in contiguous registers, but mostly it means they
have to be in memory. Thus we must force the object into a stack slot
so we can access fields.
If we could give each structure field its own DECL_RTL, then we could
access them in place without forcing the structure to a stack slot. Or
maybe we can put the PARALLEL into the structure's DECL_RTL, and modify
the access routines to parse it. I suspect it is simpler to have
separate DECL_RTLs for each field though.
There is also a simpler related problem. Some ABIs use big-endian
left-justified/little-endian right-justified for arguments smaller than
a word. The reason is that a simple word-sized word-aligned store can
then be used to put the argument in memory, and it will end up in the
same place in both the big and little endian cases. Likewise, a simple
word-sized word-aligned load can be used to load the argument into a
register. Unfortunately, gcc doesn't understand this convention, and
ends up doing bit-field operations to move the argument between regs and
memory. This often results in a series of shifts, masks, and byte-sized
loads/stores. I think it is a little embarrassing that we do this.
This does require that we have a word sized word aligned area to
load/store from/into, but that will often be the case. Stack slots are
always word sized and aligned for instance.