This is the mail archive of the gcc@gcc.gnu.org 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]

MIPS ABI changes in GCC 3.4


I've been going through and verifying the MIPS ABI changes in GCC 3.4 over
the past couple of days, for an internal port.  I came across an
inconsistency.... this is not a problem with the compiler but with the
change notes, I think, but I wanted to get your opinion.

mips-abi.html says:

==========

C. Large aggregate arguments
Affected ABIs 	n32 and n64
Endianness 	either
Conditions 	

    * An aggregate argument is passed to a function;
    * the aggregate's size is not a multiple of 8 bytes; and
    * there are enough argument registers to hold some of the aggregate, but
not enough to hold all of it.

Old behavior 	The argument was passed by reference.
New behavior 	The argument is passed by value.
Example 	

struct s { int i[17]; };
void f (struct s x);

It would take 9 registers to hold x, but only 8 argument registers are
available. Since x's size is not a multiple of 8, previous releases passed
it by reference (that is, they passed a pointer to x in $4).

The new behavior is to pass x by value. The first 8 words are passed in
argument registers and the last is passed on the stack.

================

But that doesn't match what I see.  If I use a 3.3-branch compiler and this
testcase:

struct s { int i[17]; };
int f (struct s x)
{
  return x.i[16];
}

then the struct is passed by value for little endian and by reference for
big endian.  This is because MUST_PASS_IN_STACK returns a different result;
I can't follow the 3.3 macro at all but I assume it's internally consistent. 
So this fix only affects big-endian targets (like IRIX).

Not that it really matters since 3.3 didn't support any other widely used
n32/n64 targets.

Let me know if I'm right and I'll fix the web page.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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