aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-15 14:37:28 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-15 14:37:28 +0000
commit870118b7f139a2477cd16de9d8539946959c5633 (patch)
tree0f38ba28fa9b8476ec879058ccc6a40b6b2d5bc7 /gcc/config
parentbb149ca2e912038dce733f95ab1c24ff0d1af280 (diff)
downloadgcc-870118b7f139a2477cd16de9d8539946959c5633.zip
gcc-870118b7f139a2477cd16de9d8539946959c5633.tar.gz
gcc-870118b7f139a2477cd16de9d8539946959c5633.tar.bz2
Turn FUNCTION_ARG_OFFSET into a hook
2017-09-13 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (function_arg_offset): New hook. * targhooks.h (default_function_arg_offset): Declare. * targhooks.c (default_function_arg_offset): New function. * function.c (locate_and_pad_parm): Use targetm.calls.function_arg_offset instead of FUNCTION_ARG_OFFSET. * doc/tm.texi.in (FUNCTION_ARG_OFFSET): Replace with... (TARGET_FUNCTION_ARG_OFFSET): ...this. * doc/tm.texi: Regenerate. * config/spu/spu.h (FUNCTION_ARG_OFFSET): Delete. * config/spu/spu.c (spu_function_arg_offset): New function. (TARGET_FUNCTION_ARG_OFFSET): Redefine. * system.h (FUNCTION_ARG_OFFSET): Poison. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r252821
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/spu/spu.c15
-rw-r--r--gcc/config/spu/spu.h7
2 files changed, 15 insertions, 7 deletions
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 4ce227b..a35f0b8 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -3881,6 +3881,18 @@ spu_function_arg_advance (cumulative_args_t cum_v, machine_mode mode,
: spu_hard_regno_nregs (FIRST_ARG_REGNUM, mode));
}
+/* Implement TARGET_FUNCTION_ARG_OFFSET. The SPU ABI wants 32/64-bit
+ types at offset 0 in the quad-word on the stack. 8/16-bit types
+ should be at offsets 3/2 respectively. */
+
+static HOST_WIDE_INT
+spu_function_arg_offset (machine_mode mode, const_tree type)
+{
+ if (type && INTEGRAL_TYPE_P (type) && GET_MODE_SIZE (mode) < 4)
+ return 4 - GET_MODE_SIZE (mode);
+ return 0;
+}
+
/* Implement TARGET_FUNCTION_ARG_PADDING. */
static pad_direction
@@ -7300,6 +7312,9 @@ static const struct attribute_spec spu_attribute_table[] =
#undef TARGET_FUNCTION_ARG_ADVANCE
#define TARGET_FUNCTION_ARG_ADVANCE spu_function_arg_advance
+#undef TARGET_FUNCTION_ARG_OFFSET
+#define TARGET_FUNCTION_ARG_OFFSET spu_function_arg_offset
+
#undef TARGET_FUNCTION_ARG_PADDING
#define TARGET_FUNCTION_ARG_PADDING spu_function_arg_padding
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 3e60e19..4cf426b 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -309,13 +309,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \
((CUM) = 0)
-/* The SPU ABI wants 32/64-bit types at offset 0 in the quad-word on the
- stack. 8/16-bit types should be at offsets 3/2 respectively. */
-#define FUNCTION_ARG_OFFSET(MODE, TYPE) \
-(((TYPE) && INTEGRAL_TYPE_P (TYPE) && GET_MODE_SIZE (MODE) < 4) \
- ? (4 - GET_MODE_SIZE (MODE)) \
- : 0)
-
#define PAD_VARARGS_DOWN 0
#define FUNCTION_ARG_REGNO_P(N) ((N) >= (FIRST_ARG_REGNUM) && (N) <= (LAST_ARG_REGNUM))