sparc64 emit_group_load/store change

Richard Henderson rth@cygnus.com
Fri Jan 16 01:51:00 GMT 1998


Sparc v9 has a somewhat complicated mechanism for passing small
structures.  It lays the structure out as if in memory, then
"promotes" bits of it into registers based on the basic type of
the value that winds up at an address.

In particular, structures smaller than a word are passed left-
justified in a 64-bit register. 

Aside from the in-register positioning, there are two cases that 
cause problems with the existing disjoint structure code:

  struct foo bar (struct foo *f) { return *f; }

when f is near a vma boundary and

  struct c8 { char c[8]; };
  struct c8 baz (struct c8 *c) { return *c; }

when c is not word aligned.

My solution to this was to rewrite emit_group_load/store to give
it some more information and to use the bitfield extraction/insertion
routines.  This solves the problem of loading unaligned words as
well as not reading too much. 

Once the register is loaded, I use BITS_BIG_ENDIAN to determine
if we should be left-justifying the register.  This may not be
the best predicate to be using...

ANYWAY... One of the reasons I'm bringing this up is that in the
old emit_group_load there were comments about AIX and Irix 6.
What I want to know -- particularly for AIX -- is if anything 
breaks.  I have rememberences that we never did do Irix6 structure
passing as per the ABI, so I'd like to know if it does now.

So here's the patch.  Your pardon, but it is hand-edited to bring
it down to just the relevant bits for this topic.


r~


More information about the Gcc mailing list