From b692070ff0027e7579df15be1840bf55c4bd1055 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Tue, 16 Jan 2018 14:47:49 +0000 Subject: [PATCH] Move pa.h FUNCTION_ARG_SIZE to pa.c (PR83858) The port-local FUNCTION_ARG_SIZE: ((((MODE) != BLKmode \ ? (HOST_WIDE_INT) GET_MODE_SIZE (MODE) \ : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) is used by code in pa.c and by ASM_DECLARE_FUNCTION_NAME in som.h. Treating GET_MODE_SIZE as a constant is OK for the former but not the latter, which is used in target-independent code. This caused a build failure on hppa2.0w-hp-hpux11.11. 2018-01-16 Richard Sandiford gcc/ PR target/83858 * config/pa/pa.h (FUNCTION_ARG_SIZE): Delete. * config/pa/pa-protos.h (pa_function_arg_size): Declare. * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Use pa_function_arg_size instead of FUNCTION_ARG_SIZE. * config/pa/pa.c (pa_function_arg_advance): Likewise. (pa_function_arg, pa_arg_partial_bytes): Likewise. (pa_function_arg_size): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256744 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/pa/pa-protos.h | 1 + gcc/config/pa/pa.c | 20 ++++++++++++++++---- gcc/config/pa/pa.h | 9 --------- gcc/config/pa/som.h | 4 ++-- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 026876f71db..abe3295e61e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ 2018-01-16 Richard Sandiford + PR target/83858 + * config/pa/pa.h (FUNCTION_ARG_SIZE): Delete. + * config/pa/pa-protos.h (pa_function_arg_size): Declare. + * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Use + pa_function_arg_size instead of FUNCTION_ARG_SIZE. + * config/pa/pa.c (pa_function_arg_advance): Likewise. + (pa_function_arg, pa_arg_partial_bytes): Likewise. + (pa_function_arg_size): New function. + +2018-01-16 Richard Sandiford + * fold-const.c (fold_ternary_loc): Construct the vec_perm_indices in a separate statement. diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h index e79a821203d..79685bae93a 100644 --- a/gcc/config/pa/pa-protos.h +++ b/gcc/config/pa/pa-protos.h @@ -107,5 +107,6 @@ extern void pa_asm_output_aligned_local (FILE *, const char *, unsigned int); extern void pa_hpux_asm_output_external (FILE *, tree, const char *); extern HOST_WIDE_INT pa_initial_elimination_offset (int, int); +extern HOST_WIDE_INT pa_function_arg_size (machine_mode, const_tree); extern const int pa_magic_milli[]; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index a5782fc6d43..8e7b11aab45 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -9485,7 +9485,7 @@ pa_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, const_tree type, bool named ATTRIBUTE_UNUSED) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - int arg_size = FUNCTION_ARG_SIZE (mode, type); + int arg_size = pa_function_arg_size (mode, type); cum->nargs_prototype--; cum->words += (arg_size @@ -9517,7 +9517,7 @@ pa_function_arg (cumulative_args_t cum_v, machine_mode mode, if (mode == VOIDmode) return NULL_RTX; - arg_size = FUNCTION_ARG_SIZE (mode, type); + arg_size = pa_function_arg_size (mode, type); /* If this arg would be passed partially or totally on the stack, then this routine should return zero. pa_arg_partial_bytes will @@ -9724,10 +9724,10 @@ pa_arg_partial_bytes (cumulative_args_t cum_v, machine_mode mode, if (!TARGET_64BIT) return 0; - if (FUNCTION_ARG_SIZE (mode, type) > 1 && (cum->words & 1)) + if (pa_function_arg_size (mode, type) > 1 && (cum->words & 1)) offset = 1; - if (cum->words + offset + FUNCTION_ARG_SIZE (mode, type) <= max_arg_words) + if (cum->words + offset + pa_function_arg_size (mode, type) <= max_arg_words) /* Arg fits fully into registers. */ return 0; else if (cum->words + offset >= max_arg_words) @@ -10835,4 +10835,16 @@ pa_starting_frame_offset (void) return 8; } +/* Figure out the size in words of the function argument. The size + returned by this function should always be greater than zero because + we pass variable and zero sized objects by reference. */ + +HOST_WIDE_INT +pa_function_arg_size (machine_mode mode, const_tree type) +{ + if (mode != BLKmode) + return GET_MODE_SIZE (mode); + return CEIL (int_size_in_bytes (type), UNITS_PER_WORD); +} + #include "gt-pa.h" diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 3d66a105524..243641e13b5 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -592,15 +592,6 @@ struct hppa_args {int words, nargs_prototype, incoming, indirect; }; (CUM).indirect = 0, \ (CUM).nargs_prototype = 1000 -/* Figure out the size in words of the function argument. The size - returned by this macro should always be greater than zero because - we pass variable and zero sized objects by reference. */ - -#define FUNCTION_ARG_SIZE(MODE, TYPE) \ - ((((MODE) != BLKmode \ - ? (HOST_WIDE_INT) GET_MODE_SIZE (MODE) \ - : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - /* Determine where to put an argument to a function. Value is zero to push the argument on the stack, or a hard register in which to store the argument. diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index 4a7b12344c2..eea23cc2243 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -136,8 +136,8 @@ do { \ else \ { \ int arg_size = \ - FUNCTION_ARG_SIZE (TYPE_MODE (DECL_ARG_TYPE (parm)),\ - DECL_ARG_TYPE (parm)); \ + pa_function_arg_size (TYPE_MODE (DECL_ARG_TYPE (parm)),\ + DECL_ARG_TYPE (parm)); \ /* Passing structs by invisible reference uses \ one general register. */ \ if (arg_size > 2 \ -- 2.11.4.GIT