diff options
author | Richard Henderson <rth@redhat.com> | 2004-07-13 00:45:09 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-07-13 00:45:09 -0700 |
commit | fe9841365eb7e2908f9ba6b18a85910ee9024a54 (patch) | |
tree | d6061a45fae079845a6d37d0db05d65b8eb6b121 /gcc/config/frv | |
parent | 29f1711877a0f3f6f7e36d22f4a53b0161591d4e (diff) | |
download | gcc-fe9841365eb7e2908f9ba6b18a85910ee9024a54.zip gcc-fe9841365eb7e2908f9ba6b18a85910ee9024a54.tar.gz gcc-fe9841365eb7e2908f9ba6b18a85910ee9024a54.tar.bz2 |
target-def.h (TARGET_MUST_PASS_IN_STACK): New.
* target-def.h (TARGET_MUST_PASS_IN_STACK): New.
* target.h (struct gcc_target): Add calls.must_pass_in_stack.
* expr.h (MUST_PASS_IN_STACK): Remove.
* system.h (MUST_PASS_IN_STACK): Poison.
* tree.h (must_pass_in_stack_var_size): Declare.
(must_pass_in_stack_var_size_or_pad): Declare.
* calls.c (must_pass_in_stack_var_size): New.
(must_pass_in_stack_var_size_or_pad): Rename from
default_must_pass_in_stack.
* config/alpha/alpha.c (unicosmk_must_pass_in_stack): New.
(TARGET_MUST_PASS_IN_STACK): New.
* config/alpha/unicosmk.h (MUST_PASS_IN_STACK): Remove.
* config/fr30/fr30.c (fr30_must_pass_in_stack): New.
(TARGET_MUST_PASS_IN_STACK): New.
* config/fr30/fr30.h (MUST_PASS_IN_STACK): Remove.
* config/frv/frv.c (frv_must_pass_in_stack): New.
(TARGET_MUST_PASS_IN_STACK): New.
* config/frv/frv.h (MUST_PASS_IN_STACK): Remove.
* config/i386/i386-protos.h (ix86_must_pass_in_stack): Remove.
* config/i386/i386.c (TARGET_MUST_PASS_IN_STACK): New.
(ix86_must_pass_in_stack): Make static.
* config/i386/i386.h (MUST_PASS_IN_STACK): Remove.
* config/ia64/ia64.c (TARGET_MUST_PASS_IN_STACK): New.
* config/ia64/ia64.h (MUST_PASS_IN_STACK): Remove.
* config/m32r/m32r.c (TARGET_MUST_PASS_IN_STACK): New.
* config/m32r/m32r.h (MUST_PASS_IN_STACK): Remove.
* config/mcore/mcore-protos.h (mcore_must_pass_on_stack): Remove.
* config/mcore/mcore.c (TARGET_MUST_PASS_IN_STACK): New.
(mcore_must_pass_on_stack): Remove.
* config/mcore/mcore.h (MUST_PASS_IN_STACK): Remove.
* config/mips/mips.c (TARGET_MUST_PASS_IN_STACK): New.
* config/mips/mips.h (MUST_PASS_IN_STACK): Remove.
* config/pa/pa.c (TARGET_MUST_PASS_IN_STACK): New.
* config/pa/pa.h (MUST_PASS_IN_STACK): Remove.
* config/rs6000/aix.h (MUST_PASS_IN_STACK): Remove.
* config/rs6000/linux64.h (MUST_PASS_IN_STACK): Remove.
* config/rs6000/rs6000.c (rs6000_must_pass_in_stack): New.
(TARGET_MUST_PASS_IN_STACK): New.
* config/sh/sh.c (TARGET_MUST_PASS_IN_STACK): New.
* config/sh/sh.h (MUST_PASS_IN_STACK): Remove.
* config/sparc/sparc.c (TARGET_MUST_PASS_IN_STACK): New.
* config/sparc/sparc.h (MUST_PASS_IN_STACK): Remove.
* config/xtensa/xtensa.c (TARGET_MUST_PASS_IN_STACK): New.
* config/xtensa/xtensa.h (MUST_PASS_IN_STACK): Remove.
* doc/tm.texi (TARGET_MUST_PASS_IN_STACK): Update from
MUST_PASS_IN_STACK.
* calls.c, function.c, config/alpha/alpha.c, config/alpha/alpha.h,
config/alpha/unicosmk.h, config/alpha/vms.h, config/c4x/c4x.c,
config/cris/cris.h, config/fr30/fr30.c, config/fr30/fr30.h,
config/frv/frv.c, config/i386/i386.c, config/iq2000/iq2000.c,
config/mcore/mcore.c, config/mcore/mcore.h, config/mips/mips.c,
config/mmix/mmix.c, config/mmix/mmix.h, config/rs6000/rs6000.c,
config/sh/sh.c, config/sh/sh.h, config/stormy16/stormy16.c,
config/xtensa/xtensa.c: Use target hook.
From-SVN: r84606
Diffstat (limited to 'gcc/config/frv')
-rw-r--r-- | gcc/config/frv/frv.c | 61 | ||||
-rw-r--r-- | gcc/config/frv/frv.h | 58 |
2 files changed, 17 insertions, 102 deletions
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 9866320..4d05bd4 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -287,6 +287,7 @@ static void frv_output_const_unspec (FILE *, static bool frv_function_ok_for_sibcall (tree, tree); static rtx frv_struct_value_rtx (tree, int); static tree frv_gimplify_va_arg_expr (tree, tree, tree *, tree *); +static bool frv_must_pass_in_stack (enum machine_mode mode, tree type); /* Initialize the GCC target structure. */ #undef TARGET_ASM_FUNCTION_PROLOGUE @@ -327,6 +328,8 @@ static tree frv_gimplify_va_arg_expr (tree, tree, tree *, tree *); #undef TARGET_STRUCT_VALUE_RTX #define TARGET_STRUCT_VALUE_RTX frv_struct_value_rtx +#undef TARGET_MUST_PASS_IN_STACK +#define TARGET_MUST_PASS_IN_STACK frv_must_pass_in_stack #undef TARGET_EXPAND_BUILTIN_SAVEREGS #define TARGET_EXPAND_BUILTIN_SAVEREGS frv_expand_builtin_saveregs @@ -3026,6 +3029,19 @@ frv_init_cumulative_args (CUMULATIVE_ARGS *cum, } +/* Return true if we should pass an argument on the stack rather than + in registers. */ + +static bool +frv_must_pass_in_stack (enum machine_mode mode, tree type) +{ + if (mode == BLKmode) + return true; + if (type == NULL) + return false; + return AGGREGATE_TYPE_P (type); +} + /* If defined, a C expression that gives the alignment boundary, in bits, of an argument with the specified mode and type. If it is not defined, `PARM_BOUNDARY' is used for all arguments. */ @@ -3037,37 +3053,6 @@ frv_function_arg_boundary (enum machine_mode mode ATTRIBUTE_UNUSED, return BITS_PER_WORD; } - -/* A C expression that controls whether a function argument is passed in a - register, and which register. - - The arguments are CUM, of type CUMULATIVE_ARGS, which summarizes (in a way - defined by INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE) all of the previous - arguments so far passed in registers; MODE, the machine mode of the argument; - TYPE, the data type of the argument as a tree node or 0 if that is not known - (which happens for C support library functions); and NAMED, which is 1 for an - ordinary argument and 0 for nameless arguments that correspond to `...' in the - called function's prototype. - - The value of the expression should either be a `reg' RTX for the hard - register in which to pass the argument, or zero to pass the argument on the - stack. - - For machines like the VAX and 68000, where normally all arguments are - pushed, zero suffices as a definition. - - The usual way to make the ANSI library `stdarg.h' work on a machine where - some arguments are usually passed in registers, is to cause nameless - arguments to be passed on the stack instead. This is done by making - `FUNCTION_ARG' return 0 whenever NAMED is 0. - - You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of - this macro to determine if this argument is of a type that must be passed in - the stack. If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG' - returns nonzero for such an argument, the compiler will abort. If - `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the - stack and then loaded into a register. */ - rtx frv_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, @@ -3177,25 +3162,13 @@ frv_function_arg_partial_nregs (CUMULATIVE_ARGS *cum, } - -/* A C expression that indicates when an argument must be passed by reference. - If nonzero for an argument, a copy of that argument is made in memory and a - pointer to the argument is passed instead of the argument itself. The - pointer is passed in whatever way is appropriate for passing a pointer to - that type. - - On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable - definition of this macro might be - #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ - MUST_PASS_IN_STACK (MODE, TYPE) */ - int frv_function_arg_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, enum machine_mode mode, tree type, int named ATTRIBUTE_UNUSED) { - return MUST_PASS_IN_STACK (mode, type); + return targetm.calls.must_pass_in_stack (mode, type); } /* If defined, a C expression that indicates when it is the called function's diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 29d22e4..493ebc7 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -1860,58 +1860,10 @@ struct machine_function GTY(()) #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0 -/* Function Arguments in Registers. */ - -/* Nonzero if we do not know how to pass TYPE solely in registers. - We cannot do so in the following cases: - - - if the type has variable size - - if the type is marked as addressable (it is required to be constructed - into the stack) - - if the type is a structure or union. */ - -#define MUST_PASS_IN_STACK(MODE,TYPE) \ - (((MODE) == BLKmode) \ - || ((TYPE) != 0 \ - && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \ - || TREE_CODE (TYPE) == RECORD_TYPE \ - || TREE_CODE (TYPE) == UNION_TYPE \ - || TREE_CODE (TYPE) == QUAL_UNION_TYPE \ - || TREE_ADDRESSABLE (TYPE)))) - /* The number of register assigned to holding function arguments. */ #define FRV_NUM_ARG_REGS 6 -/* A C expression that controls whether a function argument is passed in a - register, and which register. - - The arguments are CUM, of type CUMULATIVE_ARGS, which summarizes (in a way - defined by INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE) all of the previous - arguments so far passed in registers; MODE, the machine mode of the argument; - TYPE, the data type of the argument as a tree node or 0 if that is not known - (which happens for C support library functions); and NAMED, which is 1 for an - ordinary argument and 0 for nameless arguments that correspond to `...' in the - called function's prototype. - - The value of the expression should either be a `reg' RTX for the hard - register in which to pass the argument, or zero to pass the argument on the - stack. - - For machines like the VAX and 68000, where normally all arguments are - pushed, zero suffices as a definition. - - The usual way to make the ANSI library `stdarg.h' work on a machine where - some arguments are usually passed in registers, is to cause nameless - arguments to be passed on the stack instead. This is done by making - `FUNCTION_ARG' return 0 whenever NAMED is 0. - - You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of - this macro to determine if this argument is of a type that must be passed in - the stack. If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG' - returns nonzero for such an argument, the compiler will abort. If - `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the - stack and then loaded into a register. */ #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ frv_function_arg (&CUM, MODE, TYPE, NAMED, FALSE) @@ -1949,16 +1901,6 @@ struct machine_function GTY(()) /* extern int frv_function_arg_partial_nregs (CUMULATIVE_ARGS, int, Tree, int); */ -/* A C expression that indicates when an argument must be passed by reference. - If nonzero for an argument, a copy of that argument is made in memory and a - pointer to the argument is passed instead of the argument itself. The - pointer is passed in whatever way is appropriate for passing a pointer to - that type. - - On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable - definition of this macro might be - #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ - MUST_PASS_IN_STACK (MODE, TYPE) */ #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ frv_function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED) |