Commit cc15e98f by Nick Clifton Committed by Nick Clifton

sh.h (INIT_CUMULATIVE_ARGS): Replace with an invocation of the function sh_init_cumulative_args.

sh.h (INIT_CUMULATIVE_ARGS): Replace with an invocation of the function
  sh_init_cumulative_args.
  (INIT_CUMULATIVE_LIBCALL_ARGS): Likewise.
  (INIT_CUMULATIVE_INCOMING_ARGS): Delete.
sh-protos.h: Prototype sh_init_cumulative_args.
sh.c (sh_init_cumulative_args): New function based on the contents of the old
  INIT_CUMULATIVE_ARGS macro but with a heuristic added to determine the setting
  of force_mem when a library function is being called.

From-SVN: r88238
parent ee1f0fb0
2004-09-28 Nick Clifton <nickc@redhat.com>
* config/sh/sh.h (INIT_CUMULATIVE_ARGS): Replace with an
invocation of the function sh_init_cumulative_args.
(INIT_CUMULATIVE_LIBCALL_ARGS): Likewise.
(INIT_CUMULATIVE_INCOMING_ARGS): Delete.
* config/sh/sh-protos.h: Prototype sh_init_cumulative_args.
* config/sh/sh.c (sh_init_cumulative_args): New function based
on the contents of the old INIT_CUMULATIVE_ARGS macro but with a
heuristic added to determine the setting of force_mem when a
library function is being called.
2004-09-28 Diego Novillo <dnovillo@redhat.com>
* tree-ssa-loop-im.c (single_reachable_address) <PHI_NODE>:
......
......@@ -143,6 +143,7 @@ extern rtx sh_get_pr_initial_val (void);
extern rtx sh_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern void sh_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern int sh_pass_in_reg_p (CUMULATIVE_ARGS *, enum machine_mode, tree);
extern void sh_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, signed int, enum machine_mode);
extern const char *sh_pch_valid_p (const void *data_p, size_t sz);
extern bool sh_promote_prototypes (tree);
......
......@@ -10035,4 +10035,76 @@ sh_fsca_int2sf (void)
return sh_fsca_int2sf_rtx;
}
/* Initialise the CUMULATIVE_ARGS structure. */
void
sh_init_cumulative_args (CUMULATIVE_ARGS * pcum,
tree fntype,
rtx libname ATTRIBUTE_UNUSED,
tree fndecl,
signed int n_named_args,
enum machine_mode mode)
{
pcum->arg_count [(int) SH_ARG_FLOAT] = 0;
pcum->free_single_fp_reg = 0;
pcum->stack_regs = 0;
pcum->byref_regs = 0;
pcum->byref = 0;
pcum->outgoing = (n_named_args == -1) ? 0 : 1;
/* XXX - Should we check TARGET_HITACHI here ??? */
pcum->renesas_abi = sh_attr_renesas_p (fntype) ? 1 : 0;
if (fntype)
{
pcum->force_mem = ((TARGET_HITACHI || pcum->renesas_abi)
&& aggregate_value_p (TREE_TYPE (fntype), fndecl));
pcum->prototype_p = TYPE_ARG_TYPES (fntype) ? TRUE : FALSE;
pcum->arg_count [(int) SH_ARG_INT]
= TARGET_SH5 && aggregate_value_p (TREE_TYPE (fntype), fndecl);
pcum->call_cookie
= CALL_COOKIE_RET_TRAMP (TARGET_SHCOMPACT
&& pcum->arg_count [(int) SH_ARG_INT] == 0
&& (TYPE_MODE (TREE_TYPE (fntype)) == BLKmode
? int_size_in_bytes (TREE_TYPE (fntype))
: GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (fntype)))) > 4
&& (BASE_RETURN_VALUE_REG (TYPE_MODE (TREE_TYPE (fntype)))
== FIRST_RET_REG));
}
else
{
pcum->arg_count [(int) SH_ARG_INT] = 0;
pcum->prototype_p = FALSE;
if (mode != VOIDmode)
{
pcum->call_cookie =
CALL_COOKIE_RET_TRAMP (TARGET_SHCOMPACT
&& GET_MODE_SIZE (mode) > 4
&& BASE_RETURN_VALUE_REG (mode) == FIRST_RET_REG);
/* If the default ABI is the Renesas ABI then all library
calls must assume that the library will be using the
Renesas ABI. So if the function would return its result
in memory then we must force the address of this memory
block onto the stack. Ideally we would like to call
targetm.calls.return_in_memory() here but we do not have
the TYPE or the FNDECL available so we synthesise the
contents of that function as best we can. */
pcum->force_mem =
(TARGET_DEFAULT & HITACHI_BIT)
&& (mode == BLKmode
|| (GET_MODE_SIZE (mode) > 4
&& !(mode == DFmode
&& TARGET_FPU_DOUBLE)));
}
else
{
pcum->call_cookie = 0;
pcum->force_mem = FALSE;
}
}
}
#include "gt-sh.h"
......@@ -2091,48 +2091,10 @@ struct sh_args {
For TARGET_HITACHI, the structure value pointer is passed in memory. */
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
do { \
(CUM).arg_count[(int) SH_ARG_INT] = 0; \
(CUM).arg_count[(int) SH_ARG_FLOAT] = 0; \
(CUM).renesas_abi = sh_attr_renesas_p (FNTYPE) ? 1 : 0; \
(CUM).force_mem \
= ((TARGET_HITACHI || (CUM).renesas_abi) && (FNTYPE) \
&& aggregate_value_p (TREE_TYPE (FNTYPE), (FNDECL))); \
(CUM).prototype_p = (FNTYPE) && TYPE_ARG_TYPES (FNTYPE); \
(CUM).arg_count[(int) SH_ARG_INT] \
= (TARGET_SH5 && (FNTYPE) \
&& aggregate_value_p (TREE_TYPE (FNTYPE), (FNDECL))); \
(CUM).free_single_fp_reg = 0; \
(CUM).outgoing = 1; \
(CUM).stack_regs = 0; \
(CUM).byref_regs = 0; \
(CUM).byref = 0; \
(CUM).call_cookie \
= (CALL_COOKIE_RET_TRAMP \
(TARGET_SHCOMPACT && (FNTYPE) \
&& (CUM).arg_count[(int) SH_ARG_INT] == 0 \
&& (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
? int_size_in_bytes (TREE_TYPE (FNTYPE)) \
: GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (FNTYPE)))) > 4 \
&& (BASE_RETURN_VALUE_REG (TYPE_MODE (TREE_TYPE \
(FNTYPE))) \
== FIRST_RET_REG))); \
} while (0)
sh_init_cumulative_args (& (CUM), (FNTYPE), (LIBNAME), (FNDECL), (N_NAMED_ARGS), VOIDmode)
#define INIT_CUMULATIVE_LIBCALL_ARGS(CUM, MODE, LIBNAME) \
do { \
INIT_CUMULATIVE_ARGS ((CUM), NULL_TREE, (LIBNAME), 0, 0); \
(CUM).call_cookie \
= (CALL_COOKIE_RET_TRAMP \
(TARGET_SHCOMPACT && GET_MODE_SIZE (MODE) > 4 \
&& BASE_RETURN_VALUE_REG (MODE) == FIRST_RET_REG)); \
} while (0)
#define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \
do { \
INIT_CUMULATIVE_ARGS ((CUM), (FNTYPE), (LIBNAME), 0, 0); \
(CUM).outgoing = 0; \
} while (0)
sh_init_cumulative_args (& (CUM), NULL_TREE, (LIBNAME), NULL_TREE, 0, (MODE))
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
sh_function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
......
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