Re: [08/13] Use function_arg_info for TARGET_CALLEE_COPIES

2019-08-19 Thread Jeff Law
On 8/19/19 9:19 AM, Richard Sandiford wrote:
> Use function_arg_info for TARGET_CALLEE_COPIES.
> 
> The hook is passed the unpromoted type mode instead of the promoted mode.
> 
> The aarch64 definition is redundant, but worth keeping for emphasis.
> 
> 
> 2019-08-19  Richard Sandiford  
> 
> gcc/
>   * target.def (callee_copies): Take a function_arg_info instead
>   of a mode, type and named flag.
>   * doc/tm.texi: Regenerate.
>   * targhooks.h (hook_callee_copies_named): Take a function_arg_info
>   instead of a mode, type and named flag.
>   (hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false): Delete.
>   (hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true): Likewise.
>   (hook_bool_CUMULATIVE_ARGS_arg_info_true): New function.
>   * targhooks.c (hook_callee_copies_named): Take a function_arg_info
>   instead of a mode, type and named flag.
>   (hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false): Delete.
>   (hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true): Likewise.
>   (hook_bool_CUMULATIVE_ARGS_arg_info_true): New function.
>   * calls.h (reference_callee_copied): Take a function_arg_info
>   instead of a mode, type and named flag.
>   * calls.c (reference_callee_copied): Likewise.
>   (initialize_argument_information): Update call accordingly.
>   (emit_library_call_value_1): Likewise.
>   * function.c (gimplify_parameters): Likewise.
>   * config/aarch64/aarch64.c (TARGET_CALLEE_COPIES): Define to
>   hook_bool_CUMULATIVE_ARGS_arg_info_false instead of
>   hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false.
>   * config/c6x/c6x.c (c6x_callee_copies): Delete.
>   (TARGET_CALLEE_COPIES): Define to
>   hook_bool_CUMULATIVE_ARGS_arg_info_true instead.
>   * config/epiphany/epiphany.c (TARGET_CALLEE_COPIES): Define to
>   hook_bool_CUMULATIVE_ARGS_arg_info_true instead of
>   hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true.
>   * config/mips/mips.c (mips_callee_copies): Take a function_arg_info
>   instead of a mode, type and named flag.
>   * config/mmix/mmix.c (TARGET_CALLEE_COPIES): Define to
>   hook_bool_CUMULATIVE_ARGS_arg_info_true instead of
>   hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true.
>   * config/mn10300/mn10300.c (TARGET_CALLEE_COPIES): Likewise.
>   * config/msp430/msp430.c (msp430_callee_copies): Delete.
>   (TARGET_CALLEE_COPIES): Define to
>   hook_bool_CUMULATIVE_ARGS_arg_info_true instead.
>   * config/pa/pa.c (pa_callee_copies): Take a function_arg_info
>   instead of a mode, type and named flag.
>   * config/sh/sh.c (sh_callee_copies): Likewise.
>   * config/v850/v850.c (TARGET_CALLEE_COPIES): Define to
>   hook_bool_CUMULATIVE_ARGS_arg_info_true instead of
>   hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true.
> 
OK
jeff


[08/13] Use function_arg_info for TARGET_CALLEE_COPIES

2019-08-19 Thread Richard Sandiford
Use function_arg_info for TARGET_CALLEE_COPIES.

The hook is passed the unpromoted type mode instead of the promoted mode.

The aarch64 definition is redundant, but worth keeping for emphasis.


2019-08-19  Richard Sandiford  

gcc/
* target.def (callee_copies): Take a function_arg_info instead
of a mode, type and named flag.
* doc/tm.texi: Regenerate.
* targhooks.h (hook_callee_copies_named): Take a function_arg_info
instead of a mode, type and named flag.
(hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false): Delete.
(hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true): Likewise.
(hook_bool_CUMULATIVE_ARGS_arg_info_true): New function.
* targhooks.c (hook_callee_copies_named): Take a function_arg_info
instead of a mode, type and named flag.
(hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false): Delete.
(hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true): Likewise.
(hook_bool_CUMULATIVE_ARGS_arg_info_true): New function.
* calls.h (reference_callee_copied): Take a function_arg_info
instead of a mode, type and named flag.
* calls.c (reference_callee_copied): Likewise.
(initialize_argument_information): Update call accordingly.
(emit_library_call_value_1): Likewise.
* function.c (gimplify_parameters): Likewise.
* config/aarch64/aarch64.c (TARGET_CALLEE_COPIES): Define to
hook_bool_CUMULATIVE_ARGS_arg_info_false instead of
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false.
* config/c6x/c6x.c (c6x_callee_copies): Delete.
(TARGET_CALLEE_COPIES): Define to
hook_bool_CUMULATIVE_ARGS_arg_info_true instead.
* config/epiphany/epiphany.c (TARGET_CALLEE_COPIES): Define to
hook_bool_CUMULATIVE_ARGS_arg_info_true instead of
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true.
* config/mips/mips.c (mips_callee_copies): Take a function_arg_info
instead of a mode, type and named flag.
* config/mmix/mmix.c (TARGET_CALLEE_COPIES): Define to
hook_bool_CUMULATIVE_ARGS_arg_info_true instead of
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true.
* config/mn10300/mn10300.c (TARGET_CALLEE_COPIES): Likewise.
* config/msp430/msp430.c (msp430_callee_copies): Delete.
(TARGET_CALLEE_COPIES): Define to
hook_bool_CUMULATIVE_ARGS_arg_info_true instead.
* config/pa/pa.c (pa_callee_copies): Take a function_arg_info
instead of a mode, type and named flag.
* config/sh/sh.c (sh_callee_copies): Likewise.
* config/v850/v850.c (TARGET_CALLEE_COPIES): Define to
hook_bool_CUMULATIVE_ARGS_arg_info_true instead of
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true.

Index: gcc/target.def
===
--- gcc/target.def  2019-08-19 15:58:50.345918999 +0100
+++ gcc/target.def  2019-08-19 15:58:58.017863486 +0100
@@ -4653,8 +4653,8 @@ not be generated.\n\
 \n\
 The default version of this hook always returns false.",
  bool,
- (cumulative_args_t cum, machine_mode mode, const_tree type, bool named),
- hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
+ (cumulative_args_t cum, const function_arg_info &arg),
+ hook_bool_CUMULATIVE_ARGS_arg_info_false)
 
 /* Return zero for arguments passed entirely on the stack or entirely
in registers.  If passed in both, return the number of bytes passed
Index: gcc/doc/tm.texi
===
--- gcc/doc/tm.texi 2019-08-19 15:58:50.341919030 +0100
+++ gcc/doc/tm.texi 2019-08-19 15:58:58.013863514 +0100
@@ -4080,7 +4080,7 @@ The pointer is passed in whatever way is
 to that type.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_CALLEE_COPIES (cumulative_args_t 
@var{cum}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named})
+@deftypefn {Target Hook} bool TARGET_CALLEE_COPIES (cumulative_args_t 
@var{cum}, const function_arg_info @var{&arg})
 The function argument described by the parameters to this hook is
 known to be passed by reference.  The hook should return true if the
 function argument should be copied by the callee instead of copied
Index: gcc/targhooks.h
===
--- gcc/targhooks.h 2019-08-19 15:58:50.345918999 +0100
+++ gcc/targhooks.h 2019-08-19 15:58:58.017863486 +0100
@@ -67,7 +67,7 @@ extern tree default_cxx_get_cookie_size
 extern bool hook_pass_by_reference_must_pass_in_stack
   (cumulative_args_t, const function_arg_info &);
 extern bool hook_callee_copies_named
-  (cumulative_args_t ca, machine_mode, const_tree, bool);
+  (cumulative_args_t ca, const function_arg_info &);
 
 extern void default_print_operand (FILE *, rtx, int);
 extern void default_print_operand_address (FILE *, machine_mode, rtx);
@@ -135,12 +135,10 @@ extern void default_goacc_reduction (gca
 extern bool hook_bool_CUMULATIVE