Fri Jun 27 19:19:12 1997 Michael Snyder (msnyder@cleaver.cygnus.com)

* config/mips/tm-mips.h (USE_STRUCT_CONVENTION): MIPS_EABI returns
        structs in a register wherever possible.
This commit is contained in:
Michael Snyder 1997-06-28 02:23:30 +00:00
parent d006e43527
commit 0af60e0326
3 changed files with 45 additions and 13 deletions

View File

@ -1,3 +1,11 @@
Fri Jun 27 19:19:12 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
* config/mips/tm-mips.h (USE_STRUCT_CONVENTION): MIPS_EABI returns
structs in a register wherever possible.
* mips-tdep.c (mips_extract_return_value): handle structs.
(mips_store_return_value): handle values smaller than MIPS_REGSIZE
(including structs, if gdb ever allows it).
start-sanitize-sh4
Fri Jun 20 17:58:34 1997 Fred Fish <fnf@cygnus.com>

View File

@ -331,9 +331,14 @@ extern void mips_store_return_value PARAMS ((struct type *, char *));
(extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
REGISTER_RAW_SIZE (V0_REGNUM)))
#if MIPS_EABI
#undef USE_STRUCT_CONVENTION
#define USE_STRUCT_CONVENTION(gcc_p, type) \
(TYPE_LENGTH (type) > 2 * MIPS_REGSIZE)
#else
/* Structures are returned by ref in extra arg0 */
#define USE_STRUCT_CONVENTION(gcc_p, type) 1
#endif
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */

View File

@ -1911,11 +1911,17 @@ mips_extract_return_value (valtype, regbuf, valbuf)
|| (mips_fpu == MIPS_FPU_SINGLE && len <= MIPS_REGSIZE)))
regnum = FP0_REGNUM;
if (TARGET_BYTE_ORDER == BIG_ENDIAN
&& TYPE_CODE (valtype) != TYPE_CODE_FLT
&& len < REGISTER_RAW_SIZE (regnum))
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
{ /* "un-left-justify" the value from the register */
if (len < REGISTER_RAW_SIZE (regnum) &&
TYPE_CODE (valtype) != TYPE_CODE_FLT)
offset = REGISTER_RAW_SIZE (regnum) - len;
if (len > REGISTER_RAW_SIZE (regnum) && /* odd-size structs */
len < REGISTER_RAW_SIZE (regnum) * 2 &&
(TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
TYPE_CODE (valtype) == TYPE_CODE_UNION))
offset = 2 * REGISTER_RAW_SIZE (regnum) - len;
}
memcpy (valbuf, regbuf + REGISTER_BYTE (regnum) + offset, len);
REGISTER_CONVERT_TO_TYPE (regnum, valtype, valbuf);
}
@ -1928,18 +1934,31 @@ mips_store_return_value (valtype, valbuf)
char *valbuf;
{
int regnum;
int offset = 0;
int len = TYPE_LENGTH (valtype);
char raw_buffer[MAX_REGISTER_RAW_SIZE];
regnum = 2;
if (TYPE_CODE (valtype) == TYPE_CODE_FLT
&& (mips_fpu == MIPS_FPU_DOUBLE
|| (mips_fpu == MIPS_FPU_SINGLE && TYPE_LENGTH (valtype) <= 4))) /* FIXME!! */
|| (mips_fpu == MIPS_FPU_SINGLE && len <= MIPS_REGSIZE)))
regnum = FP0_REGNUM;
memcpy(raw_buffer, valbuf, TYPE_LENGTH (valtype));
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
{ /* "left-justify" the value in the register */
if (len < REGISTER_RAW_SIZE (regnum))
offset = REGISTER_RAW_SIZE (regnum) - len;
if (len > REGISTER_RAW_SIZE (regnum) && /* odd-size structs */
len < REGISTER_RAW_SIZE (regnum) * 2 &&
(TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
TYPE_CODE (valtype) == TYPE_CODE_UNION))
offset = 2 * REGISTER_RAW_SIZE (regnum) - len;
}
memcpy(raw_buffer + offset, valbuf, len);
REGISTER_CONVERT_FROM_TYPE(regnum, valtype, raw_buffer);
write_register_bytes(REGISTER_BYTE (regnum), raw_buffer, TYPE_LENGTH (valtype));
write_register_bytes(REGISTER_BYTE (regnum), raw_buffer,
len > REGISTER_RAW_SIZE (regnum) ?
len : REGISTER_RAW_SIZE (regnum));
}
/* Exported procedure: Is PC in the signal trampoline code */