From: Doug Evans Date: Fri, 12 Mar 1993 00:10:21 +0000 (+0000) Subject: * (RETURN_IN_MEMORY): Handle BLKmode values. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e14fa9c45a5fd9b4be62dedd78daa5559f4c83fc;p=gcc.git * (RETURN_IN_MEMORY): Handle BLKmode values. From-SVN: r3709 --- diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index a743989250a..23adda288ea 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -673,7 +673,8 @@ enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, are integers whose size is larger than 64 bits. */ #define RETURN_IN_MEMORY(TYPE) \ - (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE \ + (TYPE_MODE (TYPE) == BLKmode \ + || TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE \ || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64)) /* 1 if N is a possible register number for a function value diff --git a/gcc/config/i386/sysv4.h b/gcc/config/i386/sysv4.h index 7e555a2e74e..9cc99251919 100644 --- a/gcc/config/i386/sysv4.h +++ b/gcc/config/i386/sysv4.h @@ -31,7 +31,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef RETURN_IN_MEMORY #define RETURN_IN_MEMORY(TYPE) \ - (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) + (TYPE_MODE (TYPE) == BLKmode \ + || TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) /* Define which macros to predefine. __svr4__ is our extension. */ /* This used to define X86, but james@bigtex.cactus.org says that diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 265a2e6cd4d..01d2c5ef1a1 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -814,10 +814,11 @@ extern struct rtx_def *i960_function_arg (); #define FUNCTION_VALUE(TYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (TYPE), 0) -/* Force objects larger than 16 bytes to be returned in memory, since we - only have 4 registers available for return values. */ +/* Force aggregates and objects larger than 16 bytes to be returned in memory, + since we only have 4 registers available for return values. */ -#define RETURN_IN_MEMORY(TYPE) (int_size_in_bytes (TYPE) > 16) +#define RETURN_IN_MEMORY(TYPE) \ + (TYPE_MODE (TYPE) == BLKmode || int_size_in_bytes (TYPE) > 16) /* For an arg passed partly in registers and partly in memory, this is the number of registers used. diff --git a/gcc/config/m68k/apollo68.h b/gcc/config/m68k/apollo68.h index e2be431f7aa..a7989b0a872 100644 --- a/gcc/config/m68k/apollo68.h +++ b/gcc/config/m68k/apollo68.h @@ -161,7 +161,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ returned that way. */ #define RETURN_IN_MEMORY(type) \ - (GET_MODE_SIZE (TYPE_MODE (type)) > UNITS_PER_WORD) + (TYPE_MODE (type) == BLKmode \ + || GET_MODE_SIZE (TYPE_MODE (type)) > UNITS_PER_WORD) /* In order to link with Apollo libraries, we can't prefix external symbols with an underscore. */ diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 4da23ffdf8b..9e8ceb7e23d 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -999,11 +999,12 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, /* Disable the promotion of some structures and unions to registers. */ #define RETURN_IN_MEMORY(TYPE) \ - ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) \ - && !(TYPE_MODE (TYPE) == SImode \ - || (TYPE_MODE (TYPE) == BLKmode \ - && TYPE_ALIGN (TYPE) == BITS_PER_WORD \ - && int_size_in_bytes (TYPE) == UNITS_PER_WORD))) + (TYPE_MODE (TYPE) == BLKmode \ + || ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) \ + && !(TYPE_MODE (TYPE) == SImode \ + || (TYPE_MODE (TYPE) == BLKmode \ + && TYPE_ALIGN (TYPE) == BITS_PER_WORD \ + && int_size_in_bytes (TYPE) == UNITS_PER_WORD)))) /* Define how to find the value returned by a library function assuming the value has mode MODE. */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index adc3634073c..9cceff20de5 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1759,11 +1759,12 @@ extern struct mips_frame_info current_frame_info; always returned. Here TYPE will be a C expression of type `tree', representing the data type of the value. - Note that values of mode `BLKmode' are returned in memory - regardless of this macro. Also, the option `-fpcc-struct-return' + Note that values of mode `BLKmode' must be explicitly + handled by this macro. Also, the option `-fpcc-struct-return' takes effect regardless of this macro. On most systems, it is possible to leave the macro undefined; this causes a default - definition to be used, whose value is the constant 0. + definition to be used, whose value is the constant 1 for BLKmode + values, and 0 otherwise. GCC normally converts 1 byte structures into chars, 2 byte structs into shorts, and 4 byte structs into ints, and returns @@ -1771,7 +1772,8 @@ extern struct mips_frame_info current_frame_info; to give us MIPS cc compatibility. */ #define RETURN_IN_MEMORY(TYPE) \ - ((TREE_CODE (TYPE) == RECORD_TYPE) || (TREE_CODE (TYPE) == UNION_TYPE)) + ((TYPE_MODE (TYPE) == BLKmode) \ + || (TREE_CODE (TYPE) == RECORD_TYPE) || (TREE_CODE (TYPE) == UNION_TYPE)) /* A code distinguishing the floating point format of the target diff --git a/gcc/config/romp/romp.h b/gcc/config/romp/romp.h index 67178a99615..aa48d4a0016 100644 --- a/gcc/config/romp/romp.h +++ b/gcc/config/romp/romp.h @@ -552,7 +552,8 @@ enum reg_class { NO_REGS, R0_REGS, R15_REGS, BASE_REGS, GENERAL_REGS, type DImode is returned in memory. */ #define RETURN_IN_MEMORY(type) \ - (TARGET_HC_STRUCT_RETURN && TYPE_MODE (type) == DImode) + (TYPE_MODE (type) == BLKmode \ + || (TARGET_HC_STRUCT_RETURN && TYPE_MODE (type) == DImode)) /* 1 if N is a possible register number for a function value as seen by the caller. diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 3e76e3609b5..b5cc26a2f50 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -644,7 +644,8 @@ enum reg_class { NO_REGS, BASE_REGS, GENERAL_REGS, FLOAT_REGS, For the RS/6000, any structure or union type is returned in memory. */ #define RETURN_IN_MEMORY(TYPE) \ - (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE) + (TYPE_MODE (TYPE) == BLKmode \ + || TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE) /* 1 if N is a possible register number for a function value as seen by the caller. diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index c2a4816818a..be46d318932 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -447,7 +447,7 @@ extern int leaf_function; we follow GCC's normal policy. Use -fpcc-struct-value if you want to follow the ABI. */ #define RETURN_IN_MEMORY(TYPE) \ - (TYPE_MODE (TYPE) == TFmode) + (TYPE_MODE (TYPE) == BLKmode || TYPE_MODE (TYPE) == TFmode) /* Functions which return large structures get the address to place the wanted value at offset 64 from the frame. diff --git a/gcc/expr.h b/gcc/expr.h index f3a8cb59416..39e29db40ac 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -225,12 +225,11 @@ enum direction {none, upward, downward}; /* Value has this type. */ && (FUNCTION_ARG_PADDING (MODE, TYPE) \ == MUST_PASS_IN_STACK_BAD_PADDING)))) -/* Nonzero if type TYPE should be returned in memory - (even though its mode is not BLKmode). +/* Nonzero if type TYPE should be returned in memory. Most machines can use the following default definition. */ #ifndef RETURN_IN_MEMORY -#define RETURN_IN_MEMORY(TYPE) 0 +#define RETURN_IN_MEMORY(TYPE) (TYPE_MODE (TYPE) == BLKmode) #endif /* Optabs are tables saying how to generate insn bodies