Commit e14fa9c4 by Doug Evans

* (RETURN_IN_MEMORY): Handle BLKmode values.

From-SVN: r3709
parent ac07e066
...@@ -673,7 +673,8 @@ enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, ...@@ -673,7 +673,8 @@ enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS,
are integers whose size is larger than 64 bits. */ are integers whose size is larger than 64 bits. */
#define RETURN_IN_MEMORY(TYPE) \ #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)) || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64))
/* 1 if N is a possible register number for a function value /* 1 if N is a possible register number for a function value
......
...@@ -31,7 +31,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -31,7 +31,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef RETURN_IN_MEMORY #undef RETURN_IN_MEMORY
#define RETURN_IN_MEMORY(TYPE) \ #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. */ /* Define which macros to predefine. __svr4__ is our extension. */
/* This used to define X86, but james@bigtex.cactus.org says that /* This used to define X86, but james@bigtex.cactus.org says that
......
...@@ -814,10 +814,11 @@ extern struct rtx_def *i960_function_arg (); ...@@ -814,10 +814,11 @@ extern struct rtx_def *i960_function_arg ();
#define FUNCTION_VALUE(TYPE, FUNC) \ #define FUNCTION_VALUE(TYPE, FUNC) \
gen_rtx (REG, TYPE_MODE (TYPE), 0) gen_rtx (REG, TYPE_MODE (TYPE), 0)
/* Force objects larger than 16 bytes to be returned in memory, since we /* Force aggregates and objects larger than 16 bytes to be returned in memory,
only have 4 registers available for return values. */ 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, /* For an arg passed partly in registers and partly in memory,
this is the number of registers used. this is the number of registers used.
......
...@@ -161,7 +161,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -161,7 +161,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
returned that way. */ returned that way. */
#define RETURN_IN_MEMORY(type) \ #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 /* In order to link with Apollo libraries, we can't prefix external
symbols with an underscore. */ symbols with an underscore. */
......
...@@ -999,11 +999,12 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, ...@@ -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. */ /* Disable the promotion of some structures and unions to registers. */
#define RETURN_IN_MEMORY(TYPE) \ #define RETURN_IN_MEMORY(TYPE) \
((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) \ (TYPE_MODE (TYPE) == BLKmode \
&& !(TYPE_MODE (TYPE) == SImode \ || ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) \
|| (TYPE_MODE (TYPE) == BLKmode \ && !(TYPE_MODE (TYPE) == SImode \
&& TYPE_ALIGN (TYPE) == BITS_PER_WORD \ || (TYPE_MODE (TYPE) == BLKmode \
&& int_size_in_bytes (TYPE) == UNITS_PER_WORD))) && 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 /* Define how to find the value returned by a library function
assuming the value has mode MODE. */ assuming the value has mode MODE. */
......
...@@ -1759,11 +1759,12 @@ extern struct mips_frame_info current_frame_info; ...@@ -1759,11 +1759,12 @@ extern struct mips_frame_info current_frame_info;
always returned. Here TYPE will be a C expression of type always returned. Here TYPE will be a C expression of type
`tree', representing the data type of the value. `tree', representing the data type of the value.
Note that values of mode `BLKmode' are returned in memory Note that values of mode `BLKmode' must be explicitly
regardless of this macro. Also, the option `-fpcc-struct-return' handled by this macro. Also, the option `-fpcc-struct-return'
takes effect regardless of this macro. On most systems, it is takes effect regardless of this macro. On most systems, it is
possible to leave the macro undefined; this causes a default 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 GCC normally converts 1 byte structures into chars, 2 byte
structs into shorts, and 4 byte structs into ints, and returns structs into shorts, and 4 byte structs into ints, and returns
...@@ -1771,7 +1772,8 @@ extern struct mips_frame_info current_frame_info; ...@@ -1771,7 +1772,8 @@ extern struct mips_frame_info current_frame_info;
to give us MIPS cc compatibility. */ to give us MIPS cc compatibility. */
#define RETURN_IN_MEMORY(TYPE) \ #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 /* A code distinguishing the floating point format of the target
......
...@@ -552,7 +552,8 @@ enum reg_class { NO_REGS, R0_REGS, R15_REGS, BASE_REGS, GENERAL_REGS, ...@@ -552,7 +552,8 @@ enum reg_class { NO_REGS, R0_REGS, R15_REGS, BASE_REGS, GENERAL_REGS,
type DImode is returned in memory. */ type DImode is returned in memory. */
#define RETURN_IN_MEMORY(type) \ #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 /* 1 if N is a possible register number for a function value
as seen by the caller. as seen by the caller.
......
...@@ -644,7 +644,8 @@ enum reg_class { NO_REGS, BASE_REGS, GENERAL_REGS, FLOAT_REGS, ...@@ -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. */ For the RS/6000, any structure or union type is returned in memory. */
#define RETURN_IN_MEMORY(TYPE) \ #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 /* 1 if N is a possible register number for a function value
as seen by the caller. as seen by the caller.
......
...@@ -447,7 +447,7 @@ extern int leaf_function; ...@@ -447,7 +447,7 @@ extern int leaf_function;
we follow GCC's normal policy. Use -fpcc-struct-value we follow GCC's normal policy. Use -fpcc-struct-value
if you want to follow the ABI. */ if you want to follow the ABI. */
#define RETURN_IN_MEMORY(TYPE) \ #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 /* Functions which return large structures get the address
to place the wanted value at offset 64 from the frame. to place the wanted value at offset 64 from the frame.
......
...@@ -225,12 +225,11 @@ enum direction {none, upward, downward}; /* Value has this type. */ ...@@ -225,12 +225,11 @@ enum direction {none, upward, downward}; /* Value has this type. */
&& (FUNCTION_ARG_PADDING (MODE, TYPE) \ && (FUNCTION_ARG_PADDING (MODE, TYPE) \
== MUST_PASS_IN_STACK_BAD_PADDING)))) == MUST_PASS_IN_STACK_BAD_PADDING))))
/* Nonzero if type TYPE should be returned in memory /* Nonzero if type TYPE should be returned in memory.
(even though its mode is not BLKmode).
Most machines can use the following default definition. */ Most machines can use the following default definition. */
#ifndef RETURN_IN_MEMORY #ifndef RETURN_IN_MEMORY
#define RETURN_IN_MEMORY(TYPE) 0 #define RETURN_IN_MEMORY(TYPE) (TYPE_MODE (TYPE) == BLKmode)
#endif #endif
/* Optabs are tables saying how to generate insn bodies /* Optabs are tables saying how to generate insn bodies
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment