This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: function parms in regs, patch 3 of 3

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]