Commit 07385c49 by J"orn Rennecke Committed by Joern Rennecke

sh.h (STRUCT_VALUE): Just 0 for TARGET_HITACHI.

	* sh.h (STRUCT_VALUE): Just 0 for TARGET_HITACHI.
	(struct sh_args): Add new field force_mem.
	(INIT_CUMULATIVE_ARGS): Initialize it.
	(FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Act on it.

From-SVN: r33123
parent 504f140d
Wed Apr 12 20:51:20 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
* sh.h (STRUCT_VALUE): Just 0 for TARGET_HITACHI.
(struct sh_args): Add new field force_mem.
(INIT_CUMULATIVE_ARGS): Initialize it.
(FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Act on it.
Wed Apr 12 17:20:41 MET DST 2000 Jan Hubicka <jh@suse.cz> Wed Apr 12 17:20:41 MET DST 2000 Jan Hubicka <jh@suse.cz>
(expand_call): Do not reverse args in "equal from" field. (expand_call): Do not reverse args in "equal from" field.
......
...@@ -594,19 +594,9 @@ do { \ ...@@ -594,19 +594,9 @@ do { \
/* The Hitachi calling convention doesn't quite fit into this scheme since /* The Hitachi calling convention doesn't quite fit into this scheme since
the address is passed like an invisible argument, but one that is always the address is passed like an invisible argument, but one that is always
passed in memory. We approximate this by saying where the pointer is; passed in memory. */
however, this will put any actual arguments that are passed in memory
in the wrong place.
If we wanted to implement this exactly, we'd need a STRUCT_VALUE of 0,
an extra field in CUMULATIVE_ARGS, initialize it in INIT_CUMULATIVE_ARGS,
and hack FUNCTION_ARG (actually PASS_IN_REG_P) / FUNCTION_ARG_ADVANCE
to look directly at DECL_RESULT of the current function in conjunction
with CUM to determine if the argument in question it is a struct value
pointer, and if it is, pass it in memory. */
#define STRUCT_VALUE \ #define STRUCT_VALUE \
(TARGET_HITACHI \ (TARGET_HITACHI ? 0 : gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM))
? gen_rtx_MEM (Pmode, arg_pointer_rtx) \
: gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM))
#define RETURN_IN_MEMORY(TYPE) \ #define RETURN_IN_MEMORY(TYPE) \
(TYPE_MODE (TYPE) == BLKmode \ (TYPE_MODE (TYPE) == BLKmode \
...@@ -969,6 +959,7 @@ extern enum reg_class reg_class_from_letter[]; ...@@ -969,6 +959,7 @@ extern enum reg_class reg_class_from_letter[];
enum sh_arg_class { SH_ARG_INT = 0, SH_ARG_FLOAT = 1 }; enum sh_arg_class { SH_ARG_INT = 0, SH_ARG_FLOAT = 1 };
struct sh_args { struct sh_args {
int arg_count[2]; int arg_count[2];
int force_mem;
}; };
#define CUMULATIVE_ARGS struct sh_args #define CUMULATIVE_ARGS struct sh_args
...@@ -1003,12 +994,17 @@ struct sh_args { ...@@ -1003,12 +994,17 @@ struct sh_args {
For a library call, FNTYPE is 0. For a library call, FNTYPE is 0.
On SH, the offset always starts at 0: the first parm reg is always On SH, the offset always starts at 0: the first parm reg is always
the same reg for a given argument class. */ the same reg for a given argument class.
For TARGET_HITACHI, the structure value pointer is passed in memory. */
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \ #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
do { \ do { \
(CUM).arg_count[(int) SH_ARG_INT] = 0; \ (CUM).arg_count[(int) SH_ARG_INT] = 0; \
(CUM).arg_count[(int) SH_ARG_FLOAT] = 0; \ (CUM).arg_count[(int) SH_ARG_FLOAT] = 0; \
(CUM).force_mem \
= (TARGET_HITACHI && FNTYPE \
&& aggregate_value_p (TREE_TYPE (FNTYPE))); \
} while (0) } while (0)
/* Update the data in CUM to advance over an argument /* Update the data in CUM to advance over an argument
...@@ -1017,7 +1013,9 @@ struct sh_args { ...@@ -1017,7 +1013,9 @@ struct sh_args {
available.) */ available.) */
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
if (! TARGET_SH4 || PASS_IN_REG_P ((CUM), (MODE), (TYPE))) \ if ((CUM).force_mem) \
(CUM).force_mem = 0; \
else if (! TARGET_SH4 || PASS_IN_REG_P ((CUM), (MODE), (TYPE))) \
((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] \ ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] \
= (ROUND_REG ((CUM), (MODE)) \ = (ROUND_REG ((CUM), (MODE)) \
+ ((MODE) == BLKmode \ + ((MODE) == BLKmode \
...@@ -1031,6 +1029,7 @@ struct sh_args { ...@@ -1031,6 +1029,7 @@ struct sh_args {
(((TYPE) == 0 \ (((TYPE) == 0 \
|| (! TREE_ADDRESSABLE ((tree)(TYPE)) \ || (! TREE_ADDRESSABLE ((tree)(TYPE)) \
&& (! TARGET_HITACHI || ! AGGREGATE_TYPE_P (TYPE)))) \ && (! TARGET_HITACHI || ! AGGREGATE_TYPE_P (TYPE)))) \
&& ! (CUM).force_mem \
&& (TARGET_SH3E \ && (TARGET_SH3E \
? ((MODE) == BLKmode \ ? ((MODE) == BLKmode \
? (((CUM).arg_count[(int) SH_ARG_INT] * UNITS_PER_WORD \ ? (((CUM).arg_count[(int) SH_ARG_INT] * UNITS_PER_WORD \
......
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