diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-09-04 10:50:38 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-09-04 10:50:38 +0000 |
commit | 76b0cbf8b639a5cc574c199993a158586aae8225 (patch) | |
tree | b60ab368921a9b928ff81800a96afd5d8d8655f4 /gcc/calls.c | |
parent | 99e1629ff116e2e1aa37a14aa0d15b4533068927 (diff) | |
download | gcc-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/calls.c')
-rw-r--r-- | gcc/calls.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 4b34ab2..e757234 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1154,7 +1154,7 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals) #ifdef BLOCK_REG_PADDING && (BLOCK_REG_PADDING (args[i].mode, TREE_TYPE (args[i].tree_value), 1) - == downward) + == PAD_DOWNWARD) #else && BYTES_BIG_ENDIAN #endif @@ -2222,7 +2222,7 @@ compute_argument_addresses (struct arg_data *args, rtx argblock, int num_actuals } align = BITS_PER_UNIT; boundary = args[i].locate.boundary; - if (args[i].locate.where_pad != downward) + if (args[i].locate.where_pad != PAD_DOWNWARD) align = boundary; else if (CONST_INT_P (offset)) { @@ -2519,7 +2519,7 @@ load_register_parameters (struct arg_data *args, int num_actuals, upward on a BYTES_BIG_ENDIAN machine. */ if (size < UNITS_PER_WORD && (args[i].locate.where_pad - == (BYTES_BIG_ENDIAN ? upward : downward))) + == (BYTES_BIG_ENDIAN ? PAD_UPWARD : PAD_DOWNWARD))) { rtx x; int shift = (UNITS_PER_WORD - size) * BITS_PER_UNIT; @@ -2580,7 +2580,7 @@ load_register_parameters (struct arg_data *args, int num_actuals, /* Handle a BLKmode that needs shifting. */ if (nregs == 1 && size < UNITS_PER_WORD #ifdef BLOCK_REG_PADDING - && args[i].locate.where_pad == downward + && args[i].locate.where_pad == PAD_DOWNWARD #else && BYTES_BIG_ENDIAN #endif @@ -4919,7 +4919,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, upward on a BYTES_BIG_ENDIAN machine. */ if (size < UNITS_PER_WORD && (argvec[argnum].locate.where_pad - == (BYTES_BIG_ENDIAN ? upward : downward))) + == (BYTES_BIG_ENDIAN ? PAD_UPWARD : PAD_DOWNWARD))) { rtx x; int shift = (UNITS_PER_WORD - size) * BITS_PER_UNIT; @@ -5397,14 +5397,16 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags, /* Compute how much space the argument should get: round up to a multiple of the alignment for arguments. */ - if (none != FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval))) + if (targetm.calls.function_arg_padding (arg->mode, TREE_TYPE (pval)) + != PAD_NONE) used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1) / (PARM_BOUNDARY / BITS_PER_UNIT)) * (PARM_BOUNDARY / BITS_PER_UNIT)); /* Compute the alignment of the pushed argument. */ parm_align = arg->locate.boundary; - if (FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)) == downward) + if (targetm.calls.function_arg_padding (arg->mode, TREE_TYPE (pval)) + == PAD_DOWNWARD) { int pad = used - size; if (pad) @@ -5463,7 +5465,8 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags, /* When an argument is padded down, the block is aligned to PARM_BOUNDARY, but the actual argument isn't. */ - if (FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)) == downward) + if (targetm.calls.function_arg_padding (arg->mode, TREE_TYPE (pval)) + == PAD_DOWNWARD) { if (arg->locate.size.var) parm_align = BITS_PER_UNIT; @@ -5614,8 +5617,8 @@ must_pass_in_stack_var_size_or_pad (machine_mode mode, const_tree type) a register would put it into the wrong part of the register. */ if (mode == BLKmode && int_size_in_bytes (type) % (PARM_BOUNDARY / BITS_PER_UNIT) - && (FUNCTION_ARG_PADDING (mode, type) - == (BYTES_BIG_ENDIAN ? upward : downward))) + && (targetm.calls.function_arg_padding (mode, type) + == (BYTES_BIG_ENDIAN ? PAD_UPWARD : PAD_DOWNWARD))) return true; return false; |