aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sparc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-04 10:50:38 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-04 10:50:38 +0000
commit76b0cbf8b639a5cc574c199993a158586aae8225 (patch)
treeb60ab368921a9b928ff81800a96afd5d8d8655f4 /gcc/config/sparc
parent99e1629ff116e2e1aa37a14aa0d15b4533068927 (diff)
downloadgcc-76b0cbf8b639a5cc574c199993a158586aae8225.zip
gcc-76b0cbf8b639a5cc574c199993a158586aae8225.tar.gz
gcc-76b0cbf8b639a5cc574c199993a158586aae8225.tar.bz2
Turn FUNCTION_ARG_PADDING into a target hook
This involved renaming the rather general-sounding "enum direction" to "enum pad_direction" to avoid a conflict with the Fortran frontend. 2017-09-04 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * coretypes.h (pad_direction): New enum. * defaults.h (DEFAULT_FUNCTION_ARG_PADDING): Delete. (FUNCTION_ARG_PADDING): Likewise. * target.def (function_arg_padding): New hook. * targhooks.h (default_function_arg_padding): Declare. * targhooks.c (default_function_arg_padding): New function. * doc/tm.texi.in (FUNCTION_ARG_PADDING): Replace with... (TARGET_FUNCTION_ARG_PADDING): ...this. * doc/tm.texi: Regenerate. * calls.c (store_unaligned_arguments_into_pseudos): Use pad_direction instead of direction. (compute_argument_addresses): Likewise. (load_register_parameters): Likewise. (emit_library_call_value_1): Likewise. (store_one_arg): Use targetm.calls.function_arg_padding instead of FUNCTION_ARG_PADDING. (must_pass_in_stack_var_size_or_pad): Likewise. * expr.c (emit_group_load_1): Use pad_direction instead of direction. (emit_group_store): Likewise. (emit_single_push_insn_1): Use targetm.calls.function_arg_padding instead of FUNCTION_ARG_PADDING. (emit_push_insn): Likewise, and propagate enum change throughout function. * function.h (direction): Delete. (locate_and_pad_arg_data::where_pad): Use pad_direction instead of direction. * function.c (assign_parm_find_stack_rtl): Likewise. (assign_parm_setup_block_p): Likewise. (assign_parm_setup_block): Likewise. (gimplify_parameters): Likewise. (locate_and_pad_parm): Use targetm.calls.function_arg_padding instead of FUNCTION_ARG_PADDING, and propagate enum change throughout function. * config/aarch64/aarch64.h (FUNCTION_ARG_PADDING): Delete. (BLOCK_REG_PADDING): Use pad_direction instead of direction. * config/aarch64/aarch64-protos.h (aarch64_pad_arg_upward): Delete. * config/aarch64/aarch64.c (aarch64_pad_arg_upward): Replace with... (aarch64_function_arg_padding): ...this new function. (aarch64_gimplify_va_arg_expr): Use pad_direction instead of direction. (TARGET_FUNCTION_ARG_PADDING): Redefine. * config/arm/arm.h (FUNCTION_ARG_PADDING): Delete. (BLOCK_REG_PADDING): Use pad_direction instead of direction. * config/arm/arm-protos.h (arm_pad_arg_upward): Delete. * config/arm/arm.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (arm_pad_arg_upward): Replace with... (arm_function_arg_padding): ...this new function. * config/c6x/c6x.h (BLOCK_REG_PADDING): Use pad_direction instead of direction. * config/ia64/hpux.h (FUNCTION_ARG_PADDING): Delete. * config/ia64/ia64-protos.h (ia64_hpux_function_arg_padding): Delete. * config/ia64/ia64.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (ia64_hpux_function_arg_padding): Replace with... (ia64_function_arg_padding): ...this new function. Use pad_direction instead of direction. Check for TARGET_HPUX. * config/iq2000/iq2000.h (FUNCTION_ARG_PADDING): Delete. * config/iq2000/iq2000.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (iq2000_function_arg_padding): New function. * config/mips/mips-protos.h (mips_pad_arg_upward): Delete. * config/mips/mips.c (mips_pad_arg_upward): Replace with... (mips_function_arg_padding): ...this new function. (mips_pad_reg_upward): Update accordingly. (TARGET_FUNCTION_ARG_PADDING): Redefine. * config/mips/mips.h (PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding. (FUNCTION_ARG_PADDING): Delete. (BLOCK_REG_PADDING): Use pad_direction instead of direction. * config/nios2/nios2.h (FUNCTION_ARG_PADDING): Delete. (PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding. * config/nios2/nios2-protos.h (nios2_function_arg_padding): Delete. (nios2_block_reg_padding): Return pad_direction instead of direction. * config/nios2/nios2.c (nios2_block_reg_padding): Return pad_direction instead of direction. (nios2_function_arg_padding): Likewise. Make static. (TARGET_FUNCTION_ARG_PADDING): Redefine. * config/pa/pa.h (FUNCTION_ARG_PADDING): Delete. (BLOCK_REG_PADDING): Use targetm.calls.function_arg_padding. * config/pa/pa-protos.h (pa_function_arg_padding): Delete. * config/pa/pa.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (pa_function_arg_padding): Make static. Return pad_direction instead of direction. * config/powerpcspe/powerpcspe.h (FUNCTION_ARG_PADDING): Delete. (PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding. * config/powerpcspe/aix.h (BLOCK_REG_PADDING): Use pad_direction instead of direction. Use targetm.calls.function_arg_padding. * config/powerpcspe/darwin.h (BLOCK_REG_PADDING): Likewise. * config/powerpcspe/freebsd64.h (BLOCK_REG_PADDING): Likewise. * config/powerpcspe/linux64.h (BLOCK_REG_PADDING): Likewise. * config/powerpcspe/powerpcspe-protos.h (function_arg_padding): Delete. * config/powerpcspe/powerpcspe.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (function_arg_padding): Rename to... (rs6000_function_arg_padding): ...this. Make static. Return pad_direction instead of direction. (rs6000_return_in_msb): Use rs6000_function_arg_padding. * config/rs6000/rs6000.h (FUNCTION_ARG_PADDING): Delete. (PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding. * config/rs6000/aix.h (BLOCK_REG_PADDING): Use pad_direction instead of direction. Use targetm.calls.function_arg_padding. * config/rs6000/darwin.h (BLOCK_REG_PADDING): Likewise. * config/rs6000/freebsd64.h (BLOCK_REG_PADDING): Likewise. * config/rs6000/linux64.h (BLOCK_REG_PADDING): Likewise. * config/rs6000/rs6000-protos.h (function_arg_padding): Delete. * config/rs6000/rs6000.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (function_arg_padding): Rename to... (rs6000_function_arg_padding): ...this. Make static. Return pad_direction instead of direction. (rs6000_return_in_msb): Use rs6000_function_arg_padding. * config/s390/s390.h (FUNCTION_ARG_PADDING): Delete. * config/s390/s390.c (s390_function_arg_padding): New function. (TARGET_FUNCTION_ARG_PADDING): Redefine. * config/sparc/sparc.h (FUNCTION_ARG_PADDING): Delete. * config/sparc/sparc-protos.h (function_arg_padding): Delete. * config/sparc/sparc.c (TARGET_FUNCTION_ARG_PADDING): Redefine. (function_arg_padding): Rename to... (sparc_function_arg_padding): ...this. Make static. Return pad_direction instead of direction. * config/spu/spu.h (FUNCTION_ARG_PADDING): Delete. * config/spu/spu.c (spu_function_arg_padding): New function. (TARGET_FUNCTION_ARG_PADDING): Redefine. * system.h (FUNCTION_ARG_PADDING): Poison. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251648
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r--gcc/config/sparc/sparc-protos.h4
-rw-r--r--gcc/config/sparc/sparc.c16
-rw-r--r--gcc/config/sparc/sparc.h8
3 files changed, 9 insertions, 19 deletions
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index 311688f..507f0b1 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -28,10 +28,6 @@ along with GCC; see the file COPYING3. If not see
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
#endif
extern unsigned long sparc_type_code (tree);
-#ifdef ARGS_SIZE_RTX
-/* expr.h defines ARGS_SIZE_RTX and `enum direction' */
-extern enum direction function_arg_padding (machine_mode, const_tree);
-#endif /* ARGS_SIZE_RTX */
#endif /* TREE_CODE */
extern void order_regs_for_local_alloc (void);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 2358412..2fa22b8 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -648,6 +648,7 @@ static rtx sparc_function_arg (cumulative_args_t,
machine_mode, const_tree, bool);
static rtx sparc_function_incoming_arg (cumulative_args_t,
machine_mode, const_tree, bool);
+static pad_direction sparc_function_arg_padding (machine_mode, const_tree);
static unsigned int sparc_function_arg_boundary (machine_mode,
const_tree);
static int sparc_arg_partial_bytes (cumulative_args_t,
@@ -796,6 +797,8 @@ char sparc_hard_reg_printed[8];
#define TARGET_FUNCTION_ARG sparc_function_arg
#undef TARGET_FUNCTION_INCOMING_ARG
#define TARGET_FUNCTION_INCOMING_ARG sparc_function_incoming_arg
+#undef TARGET_FUNCTION_ARG_PADDING
+#define TARGET_FUNCTION_ARG_PADDING sparc_function_arg_padding
#undef TARGET_FUNCTION_ARG_BOUNDARY
#define TARGET_FUNCTION_ARG_BOUNDARY sparc_function_arg_boundary
@@ -7315,18 +7318,17 @@ sparc_function_arg_advance (cumulative_args_t cum_v, machine_mode mode,
}
}
-/* Handle the FUNCTION_ARG_PADDING macro.
- For the 64-bit ABI structs are always stored left shifted in their
- argument slot. */
+/* Implement TARGET_FUNCTION_ARG_PADDING. For the 64-bit ABI structs
+ are always stored left shifted in their argument slot. */
-enum direction
-function_arg_padding (machine_mode mode, const_tree type)
+static pad_direction
+sparc_function_arg_padding (machine_mode mode, const_tree type)
{
if (TARGET_ARCH64 && type && AGGREGATE_TYPE_P (type))
- return upward;
+ return PAD_UPWARD;
/* Fall back to the default. */
- return DEFAULT_FUNCTION_ARG_PADDING (mode, type);
+ return default_function_arg_padding (mode, type);
}
/* Handle the TARGET_RETURN_IN_MEMORY target hook.
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 1aa46d3..36f7667 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1215,14 +1215,6 @@ struct sparc_args {
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
init_cumulative_args (& (CUM), (FNTYPE), (LIBNAME), (FNDECL));
-/* If defined, a C expression which determines whether, and in which direction,
- to pad out an argument with extra space. The value should be of type
- `enum direction': either `upward' to pad above the argument,
- `downward' to pad below, or `none' to inhibit padding. */
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
-function_arg_padding ((MODE), (TYPE))
-
/* Generate the special assembly code needed to tell the assembler whatever
it might need to know about the return value of a function.