Re: [rfa] mips argument passing fixes for o32

Andrew Cagney
2001-07-16T16:44:00Z

> |> if (!MIPS_EABI
> |> && MIPS_SAVED_REGSIZE < 8
> |> - && TARGET_BYTE_ORDER == BIG_ENDIAN
> |> + && (TARGET_BYTE_ORDER == BIG_ENDIAN
> |> + || TYPE_LENGTH (arg_type) < MIPS_SAVED_REGSIZE)
> |> && partial_len < MIPS_SAVED_REGSIZE
> |> && (typecode == TYPE_CODE_STRUCT ||
> |> typecode == TYPE_CODE_UNION))
> |
> |I don't know that line being added should be
>
>
> ||| TYPE_LENGTH (arg_type) < MIPS_SAVED_REGSIZE
> |
> |
> |it should at least be guarded by ``ABI == o32''. What does LE n32 do
> |for instance?
> |If GCC, for o32, always left shifts the structs dregs (PARTIAL_LEN < |MIPS_SAVED_REGSIZE) then is just the ABI test needed?
> |
> | Andrew
> |
> |PS: That function is the official example of how to _not_ multi-arch an ABI.
>
> And now I confess I don't quite understand the question.
> Ah. mips_push_arguments().
> The question is whether to shift the contents?
>
> It's likely I don't really grasp the subtleties of the question
> here at the moment.
> struct mys {
> int a;
> char b;
> };
>
> as a struct argument, with cc -32 -EL, does not seem to do more than
> load b into the second arg reg (r5) and a into r4 if one does
> struct mys m
> myfunc(m);
> But I don't feel confident that answers anything, really.

The debate os over a possible exception to this rule. Given a very
small structure and the code segment:

struct c1 { char c; } s1;
foo (struct c1);
...
foo (s1);

GCC is always left shifting s1 in a register (regardless of -EL or EB).

> I (and anyone with IRIX cc -32) can do -EL -32.
> (With -n32 and -64, -EL is ignored by IRIX cc. )
> If you had a sample you wondered about I could certainly
> compile it -EL, send assembler to anyone.
> If it would help. As I said,
> any IRIX cc -32 still sort of, unoficially, does try to honor -EL.

gdb/testsuite/gdb.base/structs.c is pretty good but just the above
segment is :-)

Andrew