re PR rtl-optimization/5742 (bug with -freg-struct-return and functions returning 1 byte values)

PR optimization/5742
        * machmode.def: Add inner mode field to complex modes.
        * config/mips/mips.c (mips_function_value): Always define.  Add
        new argument to handle libcalls.
        * config/mips/mips.h (LIBCALL_VALUE): Use mips_function_value.
        (FUNCTION_VALUE): Likewise.
        * config/mips/abi64.h (FUNCTION_VALUE): Remove.
        * config/mips/mips-protos.h: Update.

From-SVN: r51251
This commit is contained in:
Richard Henderson 2002-03-24 00:13:16 -08:00 committed by Richard Henderson
parent 5314ffd366
commit 3c813ce09b
6 changed files with 46 additions and 44 deletions

View File

@ -1,3 +1,14 @@
2002-03-24 Richard Henderson <rth@redhat.com>
PR optimization/5742
* machmode.def: Add inner mode field to complex modes.
* config/mips/mips.c (mips_function_value): Always define. Add
new argument to handle libcalls.
* config/mips/mips.h (LIBCALL_VALUE): Use mips_function_value.
(FUNCTION_VALUE): Likewise.
* config/mips/abi64.h (FUNCTION_VALUE): Remove.
* config/mips/mips-protos.h: Update.
2002-03-23 Richard Henderson <rth@redhat.com>
* config/sparc/sparc.c (sparc_emit_floatunsdi): New.

View File

@ -98,9 +98,6 @@ Boston, MA 02111-1307, USA. */
> (2 * UNITS_PER_WORD)) \
|| (int_size_in_bytes (TYPE) == -1)))
#undef FUNCTION_VALUE
#define FUNCTION_VALUE(VALTYPE, FUNC) mips_function_value (VALTYPE, FUNC)
/* For varargs, we must save the current argument, because it is the fake
argument va_alist, and will need to be converted to the real argument.
For stdarg, we do not need to save the current argument, because it

View File

@ -49,7 +49,8 @@ extern struct rtx_def * mips16_gp_pseudo_reg PARAMS ((void));
#ifdef ASM_OUTPUT_UNDEF_FUNCTION
extern int mips_output_external_libcall PARAMS ((FILE *, const char *));
#endif /* ASM_OUTPUT_UNDEF_FUNCTION */
extern struct rtx_def *mips_function_value PARAMS ((tree, tree));
extern struct rtx_def *mips_function_value PARAMS ((tree, tree,
enum machine_mode));
extern unsigned int mips_hard_regno_nregs PARAMS ((int,
enum machine_mode));

View File

@ -7926,22 +7926,25 @@ mips_select_section (decl, reloc)
}
}
#ifdef MIPS_ABI_DEFAULT
/* Support functions for the 64 bit ABI. */
/* Return register to use for a function return value with VALTYPE for function
FUNC. */
/* Return register to use for a function return value with VALTYPE for
function FUNC. MODE is used instead of VALTYPE for LIBCALLs. */
rtx
mips_function_value (valtype, func)
mips_function_value (valtype, func, mode)
tree valtype;
tree func ATTRIBUTE_UNUSED;
enum machine_mode mode;
{
int reg = GP_RETURN;
enum machine_mode mode = TYPE_MODE (valtype);
enum mode_class mclass = GET_MODE_CLASS (mode);
int unsignedp = TREE_UNSIGNED (valtype);
enum mode_class mclass;
int unsignedp = 1;
if (valtype)
{
mode = TYPE_MODE (valtype);
unsignedp = TREE_UNSIGNED (valtype);
}
mclass = GET_MODE_CLASS (mode);
/* Since we define PROMOTE_FUNCTION_RETURN, we must promote the mode
just as PROMOTE_MODE does. */
@ -7966,7 +7969,7 @@ mips_function_value (valtype, func)
/* When FP registers are 32 bits, we can't directly reference
the odd numbered ones, so let's make a pair of evens. */
enum machine_mode cmode = TYPE_MODE (TREE_TYPE (valtype));
enum machine_mode cmode = GET_MODE_INNER (mode);
return gen_rtx_PARALLEL
(VOIDmode,
@ -7984,7 +7987,7 @@ mips_function_value (valtype, func)
reg = FP_RETURN;
}
else if (TREE_CODE (valtype) == RECORD_TYPE
else if (valtype && TREE_CODE (valtype) == RECORD_TYPE
&& mips_abi != ABI_32
&& mips_abi != ABI_O64
&& mips_abi != ABI_EABI)
@ -8051,7 +8054,6 @@ mips_function_value (valtype, func)
return gen_rtx_REG (mode, reg);
}
#endif
/* The implementation of FUNCTION_ARG_PASS_BY_REFERENCE. Return
nonzero when an argument must be passed by reference. */

View File

@ -2699,25 +2699,16 @@ extern struct mips_frame_info current_frame_info;
PROMOTE_FUNCTION_RETURN, we must promote the mode just as
PROMOTE_MODE does. */
#define LIBCALL_VALUE(MODE) \
gen_rtx (REG, \
((GET_MODE_CLASS (MODE) != MODE_INT \
|| GET_MODE_SIZE (MODE) >= 4) \
? (MODE) \
: SImode), \
((GET_MODE_CLASS (MODE) == MODE_FLOAT \
&& (! TARGET_SINGLE_FLOAT \
|| GET_MODE_SIZE (MODE) <= 4)) \
? FP_RETURN \
: GP_RETURN))
#define LIBCALL_VALUE(MODE) \
mips_function_value (NULL_TREE, NULL, (MODE))
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
otherwise, FUNC is 0. */
#define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
#define FUNCTION_VALUE(VALTYPE, FUNC) \
mips_function_value ((VALTYPE), (FUNC), VOIDmode)
/* 1 if N is a possible register number for a function value.
On the MIPS, R2 R3 and F0 F2 are the only register thus used.

View File

@ -65,8 +65,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
The ordering is by increasing byte size, with QI coming before HI,
HI before SI, etc.
Eigth arg is the mode of the internal elements in a vector.
VOIDmode if not a vector.
Eigth arg is the mode of the internal elements in a vector or
complex, and VOIDmode if not applicable.
*/
/* VOIDmode is used when no mode needs to be specified,
@ -98,19 +98,19 @@ DEF_MACHMODE (XFmode, "XF", MODE_FLOAT, BITS_PER_UNIT*12, 12, 12, TFmode, VOIDmo
DEF_MACHMODE (TFmode, "TF", MODE_FLOAT, BITS_PER_UNIT*16, 16, 16, VOIDmode, VOIDmode)
/* Complex modes. */
DEF_MACHMODE (QCmode, "QC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*2, 2, 1, HCmode, VOIDmode)
DEF_MACHMODE (HCmode, "HC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*4, 4, 2, SCmode, VOIDmode)
DEF_MACHMODE (SCmode, "SC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*8, 8, 4, DCmode, VOIDmode)
DEF_MACHMODE (DCmode, "DC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*16, 16, 8, XCmode, VOIDmode)
DEF_MACHMODE (XCmode, "XC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*24, 24, 12, TCmode, VOIDmode)
DEF_MACHMODE (TCmode, "TC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*32, 32, 16, VOIDmode, VOIDmode)
DEF_MACHMODE (QCmode, "QC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*2, 2, 1, HCmode, QFmode)
DEF_MACHMODE (HCmode, "HC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*4, 4, 2, SCmode, HFmode)
DEF_MACHMODE (SCmode, "SC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*8, 8, 4, DCmode, SFmode)
DEF_MACHMODE (DCmode, "DC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*16, 16, 8, XCmode, DFmode)
DEF_MACHMODE (XCmode, "XC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*24, 24, 12, TCmode, XFmode)
DEF_MACHMODE (TCmode, "TC", MODE_COMPLEX_FLOAT, BITS_PER_UNIT*32, 32, 16, VOIDmode, TFmode)
DEF_MACHMODE (CQImode, "CQI", MODE_COMPLEX_INT, BITS_PER_UNIT*2, 2, 1, CHImode, VOIDmode)
DEF_MACHMODE (CHImode, "CHI", MODE_COMPLEX_INT, BITS_PER_UNIT*4, 4, 2, CSImode, VOIDmode)
DEF_MACHMODE (CSImode, "CSI", MODE_COMPLEX_INT, BITS_PER_UNIT*8, 8, 4, CDImode, VOIDmode)
DEF_MACHMODE (CDImode, "CDI", MODE_COMPLEX_INT, BITS_PER_UNIT*16, 16, 8, CTImode, VOIDmode)
DEF_MACHMODE (CTImode, "CTI", MODE_COMPLEX_INT, BITS_PER_UNIT*32, 32, 16, COImode, VOIDmode)
DEF_MACHMODE (COImode, "COI", MODE_COMPLEX_INT, BITS_PER_UNIT*64, 64, 32, VOIDmode, VOIDmode)
DEF_MACHMODE (CQImode, "CQI", MODE_COMPLEX_INT, BITS_PER_UNIT*2, 2, 1, CHImode, QImode)
DEF_MACHMODE (CHImode, "CHI", MODE_COMPLEX_INT, BITS_PER_UNIT*4, 4, 2, CSImode, HImode)
DEF_MACHMODE (CSImode, "CSI", MODE_COMPLEX_INT, BITS_PER_UNIT*8, 8, 4, CDImode, SImode)
DEF_MACHMODE (CDImode, "CDI", MODE_COMPLEX_INT, BITS_PER_UNIT*16, 16, 8, CTImode, DImode)
DEF_MACHMODE (CTImode, "CTI", MODE_COMPLEX_INT, BITS_PER_UNIT*32, 32, 16, COImode, TImode)
DEF_MACHMODE (COImode, "COI", MODE_COMPLEX_INT, BITS_PER_UNIT*64, 64, 32, VOIDmode, OImode)
/* Vector modes. */
/* There are no V1xx vector modes. These are equivalent to normal