This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

hookize function_arg_callee_copies


I realize that we're now in stage 3, but this is preperatory to
fixing a regression on PA.

Joern, please explain the rationale behind the current formation
of sh_callee_copies.  It looks wrong to me.


r~


        * function.c (reference_callee_copied): New.
        (assign_parm_setup_reg): Use it.
        * calls.c (initialize_argument_information): Likewise.
        (emit_library_call_value_1): Likewise.
        * function.h (reference_callee_copied): Declare.
                                                                                
        * target.h (struct gcc_target): Add callee_copies.
        * target-def.h (TARGET_CALLEE_COPIES): New.
        (TARGET_PASS_BY_REFERENCE): Update default.
        * expr.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * targhooks.c (hook_callee_copies_named): New.
        (hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false): Rename from
        hook_pass_by_reference_false.
        (hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true): New.
        * targhooks.h: Update decls.
        * config/arc/arc.c (TARGET_CALLEE_COPIES): New.
        * config/arc/arc.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/frv/frv-protos.h (frv_function_arg_callee_copies): Remove.
        * config/frv/frv.c (frv_function_arg_callee_copies): Remove.
        * config/frv/frv.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/iq2000/iq2000.c (TARGET_CALLEE_COPIES): New.
        * config/iq2000/iq2000.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/m68hc11/m68hc11.c (TARGET_CALLEE_COPIES): New.
        * config/m68hc11/m68hc11.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/mips/mips.c (TARGET_CALLEE_COPIES): New.
        (mips_callee_copies): New.
        * config/mips/mips.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/mmix/mmix.c (TARGET_CALLEE_COPIES): New.
        * config/mmix/mmix.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/mn10300/mn10300.c (TARGET_CALLEE_COPIES): New.
        * config/mn10300/mn10300.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/pa/pa.c (TARGET_CALLEE_COPIES): New.
        * config/pa/pa.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/sh/sh.c (sh_callee_copies): New.
        (TARGET_CALLEE_COPIES): New.
        * config/sh/sh.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * config/v850/v850.c (TARGET_CALLEE_COPIES): New.
        * config/v850/v850.h (FUNCTION_ARG_CALLEE_COPIES): Remove.
        * doc/tm.texi (TARGET_CALLEE_COPIES): Replace documentation
        for FUNCTION_ARG_CALLEE_COPIES.
        * doc/rtl.texi (CALL_INSN_FUNCTION_USAGE): Update.

Index: gcc/calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.366
diff -u -p -u -r1.366 calls.c
--- gcc/calls.c	7 Sep 2004 10:19:00 -0000	1.366
+++ gcc/calls.c	8 Sep 2004 18:31:28 -0000
@@ -974,8 +974,8 @@ initialize_argument_information (int num
 	  tree base;
 
 	  callee_copies
-	    = FUNCTION_ARG_CALLEE_COPIES (*args_so_far, TYPE_MODE (type),
-					  type, argpos < n_named_args);
+	    = reference_callee_copied (args_so_far, TYPE_MODE (type),
+				       type, argpos < n_named_args);
 
 	  /* If we're compiling a thunk, pass through invisible references
 	     instead of making a copy.  */
@@ -3333,8 +3333,8 @@ emit_library_call_value_1 (int retval, r
       if (pass_by_reference (&args_so_far, mode, NULL_TREE, 1))
 	{
 	  rtx slot;
-	  int must_copy = ! FUNCTION_ARG_CALLEE_COPIES (args_so_far, mode,
-							NULL_TREE, 1);
+	  int must_copy
+	    = !reference_callee_copied (&args_so_far, mode, NULL_TREE, 1);
 
 	  /* loop.c won't look at CALL_INSN_FUNCTION_USAGE of const/pure
 	     functions, so we have to pretend this isn't such a function.  */
Index: gcc/expr.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.h,v
retrieving revision 1.170
diff -u -p -u -r1.170 expr.h
--- gcc/expr.h	18 Aug 2004 08:23:46 -0000	1.170
+++ gcc/expr.h	8 Sep 2004 18:31:28 -0000
@@ -188,10 +188,6 @@ do {							\
 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
 #endif
 
-#ifndef FUNCTION_ARG_CALLEE_COPIES
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 0
-#endif
-
 tree split_complex_types (tree);
 tree split_complex_values (tree);
 
Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.572
diff -u -p -u -r1.572 function.c
--- gcc/function.c	8 Sep 2004 15:44:46 -0000	1.572
+++ gcc/function.c	8 Sep 2004 18:31:29 -0000
@@ -1951,6 +1951,18 @@ pass_by_reference (CUMULATIVE_ARGS *ca, 
   return targetm.calls.pass_by_reference (ca, mode, type, named_arg);
 }
 
+/* Return true if TYPE, which is passed by reference, should be callee
+   copied instead of caller copied.  */
+
+bool
+reference_callee_copied (CUMULATIVE_ARGS *ca, enum machine_mode mode,
+			 tree type, bool named_arg)
+{
+  if (type && TREE_ADDRESSABLE (type))
+    return false;
+  return targetm.calls.callee_copies (ca, mode, type, named_arg);
+}
+
 /* Structures to communicate between the subroutines of assign_parms.
    The first holds data persistent across all parameters, the second
    is cleared out for each parameter.  */
@@ -2766,9 +2778,8 @@ assign_parm_setup_reg (struct assign_par
     {
       tree type = TREE_TYPE (data->passed_type);
     
-      if (FUNCTION_ARG_CALLEE_COPIES (all->args_so_far, TYPE_MODE (type),
-				      type, data->named_arg)
-	   && !TREE_ADDRESSABLE (type))
+      if (reference_callee_copied (&all->args_so_far, TYPE_MODE (type),
+				   type, data->named_arg))
 	{
 	  rtx copy;
 
Index: gcc/function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.132
diff -u -p -u -r1.132 function.h
--- gcc/function.h	9 Aug 2004 07:14:15 -0000	1.132
+++ gcc/function.h	8 Sep 2004 18:31:29 -0000
@@ -543,5 +543,7 @@ extern void do_warn_unused_parameter (tr
 
 extern bool pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
 			       tree, bool);
+extern bool reference_callee_copied (CUMULATIVE_ARGS *, enum machine_mode,
+				     tree, bool);
 
 #endif  /* GCC_FUNCTION_H */
Index: gcc/target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.101
diff -u -p -u -r1.101 target-def.h
--- gcc/target-def.h	4 Sep 2004 08:50:35 -0000	1.101
+++ gcc/target-def.h	8 Sep 2004 18:31:29 -0000
@@ -383,12 +383,10 @@ Foundation, 59 Temple Place - Suite 330,
 #define TARGET_SPLIT_COMPLEX_ARG NULL
 
 #define TARGET_GIMPLIFY_VA_ARG_EXPR std_gimplify_va_arg_expr
-
-#define TARGET_PASS_BY_REFERENCE hook_pass_by_reference_false
-
+#define TARGET_PASS_BY_REFERENCE hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
 #define TARGET_LATE_RTL_PROLOGUE_EPILOGUE false
-
 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size_or_pad
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
 
 #define TARGET_CALLS {						\
    TARGET_PROMOTE_FUNCTION_ARGS,				\
@@ -403,7 +401,8 @@ Foundation, 59 Temple Place - Suite 330,
    TARGET_STRICT_ARGUMENT_NAMING,				\
    TARGET_PRETEND_OUTGOING_VARARGS_NAMED,			\
    TARGET_SPLIT_COMPLEX_ARG,					\
-   TARGET_MUST_PASS_IN_STACK					\
+   TARGET_MUST_PASS_IN_STACK,					\
+   TARGET_CALLEE_COPIES						\
    }
 
 
Index: gcc/target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.113
diff -u -p -u -r1.113 target.h
--- gcc/target.h	5 Sep 2004 16:05:00 -0000	1.113
+++ gcc/target.h	8 Sep 2004 18:31:29 -0000
@@ -502,6 +502,12 @@ struct gcc_target
     /* ??? This predicate should be applied strictly after pass-by-reference.
        Need audit to verify that this is the case.  */
     bool (* must_pass_in_stack) (enum machine_mode mode, tree t);
+
+    /* Return true if type TYPE, mode MODE, which is passed by reference,
+       should have the object copy generated by the callee rather than
+       the caller.  It is never called for TYPE requiring constructors.  */
+    bool (* callee_copies) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
+			    tree type, bool named);
   } calls;
 
   /* Functions specific to the C++ frontend.  */
Index: gcc/targhooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/targhooks.c,v
retrieving revision 2.28
diff -u -p -u -r2.28 targhooks.c
--- gcc/targhooks.c	4 Sep 2004 08:50:35 -0000	2.28
+++ gcc/targhooks.c	8 Sep 2004 18:31:29 -0000
@@ -184,17 +184,6 @@ default_cxx_get_cookie_size (tree type)
   return cookie_size;
 }
 
-/* This version of the TARGET_PASS_BY_REFERENCE hook adds no conditions
-   beyond those mandated by generic code.  */
-
-bool
-hook_pass_by_reference_false (CUMULATIVE_ARGS *c ATTRIBUTE_UNUSED,
-	enum machine_mode mode ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED,
-	bool named_arg ATTRIBUTE_UNUSED)
-{
-  return false;
-}
-
 /* Return true if a parameter must be passed by reference.  This version
    of the TARGET_PASS_BY_REFERENCE hook uses just MUST_PASS_IN_STACK.  */
 
@@ -206,6 +195,16 @@ hook_pass_by_reference_must_pass_in_stac
   return targetm.calls.must_pass_in_stack (mode, type);
 }
 
+/* Return true if a parameter follows callee copies conventions.  This
+   version of the hook is true for all named arguments.  */
+
+bool
+hook_callee_copies_named (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
+			  enum machine_mode mode ATTRIBUTE_UNUSED,
+			  tree type ATTRIBUTE_UNUSED, bool named)
+{
+  return named;
+}
 
 /* Emit any directives required to unwind this instruction.  */
 
@@ -262,3 +261,21 @@ default_scalar_mode_supported_p (enum ma
       abort ();
     }
 }
+
+bool
+hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false (
+	CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
+	enum machine_mode mode ATTRIBUTE_UNUSED,
+	tree type ATTRIBUTE_UNUSED, bool named ATTRIBUTE_UNUSED)
+{
+  return false;
+}
+
+bool
+hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true (
+	CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
+	enum machine_mode mode ATTRIBUTE_UNUSED,
+	tree type ATTRIBUTE_UNUSED, bool named ATTRIBUTE_UNUSED)
+{
+  return true;
+}
Index: gcc/targhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/targhooks.h,v
retrieving revision 2.19
diff -u -p -u -r2.19 targhooks.h
--- gcc/targhooks.h	4 Sep 2004 08:50:34 -0000	2.19
+++ gcc/targhooks.h	8 Sep 2004 18:31:29 -0000
@@ -28,22 +28,31 @@ extern bool default_return_in_memory (tr
 extern rtx default_expand_builtin_saveregs (void);
 extern void default_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
 extern rtx default_builtin_setjmp_frame_value (void);
-extern bool hook_bool_CUMULATIVE_ARGS_false (CUMULATIVE_ARGS *);
 extern bool default_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
 
 extern enum machine_mode default_eh_return_filter_mode (void);
 extern unsigned HOST_WIDE_INT default_shift_truncation_mask
   (enum machine_mode);
 
-extern bool hook_bool_CUMULATIVE_ARGS_true (CUMULATIVE_ARGS *);
 extern tree default_cxx_guard_type (void);
 extern tree default_cxx_get_cookie_size (tree);
 
-extern bool hook_pass_by_reference_false
-  (CUMULATIVE_ARGS *, enum machine_mode mode, tree, bool);
 extern bool hook_pass_by_reference_must_pass_in_stack
   (CUMULATIVE_ARGS *, enum machine_mode mode, tree, bool);
+extern bool hook_callee_copies_named
+  (CUMULATIVE_ARGS *ca, enum machine_mode, tree, bool);
 
 extern void default_unwind_emit (FILE *, rtx);
 
 extern bool default_scalar_mode_supported_p (enum machine_mode);
+
+/* These are here, and not in hooks.[ch], because not all users of
+   hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS.  */
+
+extern bool hook_bool_CUMULATIVE_ARGS_false (CUMULATIVE_ARGS *);
+extern bool hook_bool_CUMULATIVE_ARGS_true (CUMULATIVE_ARGS *);
+
+extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
+  (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
+extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
+  (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
Index: gcc/config/arc/arc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc.c,v
retrieving revision 1.60
diff -u -p -u -r1.60 arc.c
--- gcc/config/arc/arc.c	20 Jul 2004 07:27:02 -0000	1.60
+++ gcc/config/arc/arc.c	8 Sep 2004 18:31:30 -0000
@@ -142,6 +142,8 @@ static bool arc_pass_by_reference (CUMUL
 #define TARGET_RETURN_IN_MEMORY arc_return_in_memory
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE arc_pass_by_reference
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS arc_setup_incoming_varargs
@@ -2356,4 +2358,3 @@ arc_pass_by_reference (CUMULATIVE_ARGS *
 
   return size > 8;
 }
-
Index: gcc/config/arc/arc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc.h,v
retrieving revision 1.79
diff -u -p -u -r1.79 arc.h
--- gcc/config/arc/arc.h	18 Aug 2004 17:05:02 -0000	1.79
+++ gcc/config/arc/arc.h	8 Sep 2004 18:31:30 -0000
@@ -696,15 +696,6 @@ extern enum reg_class arc_regno_reg_clas
    registers.  */
 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
 
-/* A C expression that indicates when it is the called function's
-   responsibility to make copies of arguments passed by reference.
-   If the callee can determine that the argument won't be modified, it can
-   avoid the copy.  */
-/* ??? We'd love to be able to use NAMED here.  Unfortunately, it doesn't
-   include the last named argument so we keep track of the args ourselves.  */
-
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
-
 /* Update the data in CUM to advance over an argument
    of mode MODE and data type TYPE.
    (TYPE is null for libcalls where that information may not be available.)  */
Index: gcc/config/frv/frv-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv-protos.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 frv-protos.h
--- gcc/config/frv/frv-protos.h	14 Jul 2004 06:24:13 -0000	1.17
+++ gcc/config/frv/frv-protos.h	8 Sep 2004 18:31:30 -0000
@@ -84,10 +84,6 @@ extern int frv_function_arg_partial_nreg
 						 enum machine_mode,
 						 tree, int);
 
-extern int frv_function_arg_callee_copies	(CUMULATIVE_ARGS *,
-						 enum machine_mode,
-						 tree, int);
-
 extern void frv_expand_builtin_va_start		(tree, rtx);
 #endif /* TREE_CODE */
 
Index: gcc/config/frv/frv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.c,v
retrieving revision 1.65
diff -u -p -u -r1.65 frv.c
--- gcc/config/frv/frv.c	25 Aug 2004 07:34:51 -0000	1.65
+++ gcc/config/frv/frv.c	8 Sep 2004 18:31:31 -0000
@@ -3144,25 +3144,6 @@ frv_function_arg_partial_nregs (CUMULATI
 }
 
 
-/* If defined, a C expression that indicates when it is the called function's
-   responsibility to make a copy of arguments passed by invisible reference.
-   Normally, the caller makes a copy and passes the address of the copy to the
-   routine being called.  When FUNCTION_ARG_CALLEE_COPIES is defined and is
-   nonzero, the caller does not make a copy.  Instead, it passes a pointer to
-   the "live" value.  The called function must not modify this value.  If it
-   can be determined that the value won't be modified, it need not make a copy;
-   otherwise a copy must be made.  */
-
-int
-frv_function_arg_callee_copies (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
-                                enum machine_mode mode ATTRIBUTE_UNUSED,
-                                tree type ATTRIBUTE_UNUSED,
-                                int named ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
-
 /* Return true if a register is ok to use as a base or index register.  */
 
 static FRV_INLINE int
Index: gcc/config/frv/frv.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.h,v
retrieving revision 1.52
diff -u -p -u -r1.52 frv.h
--- gcc/config/frv/frv.h	18 Aug 2004 17:05:05 -0000	1.52
+++ gcc/config/frv/frv.h	8 Sep 2004 18:31:31 -0000
@@ -1903,17 +1903,6 @@ struct machine_function GTY(())
 
 /* extern int frv_function_arg_partial_nregs (CUMULATIVE_ARGS, int, Tree, int);  */
 
-/* If defined, a C expression that indicates when it is the called function's
-   responsibility to make a copy of arguments passed by invisible reference.
-   Normally, the caller makes a copy and passes the address of the copy to the
-   routine being called.  When FUNCTION_ARG_CALLEE_COPIES is defined and is
-   nonzero, the caller does not make a copy.  Instead, it passes a pointer to
-   the "live" value.  The called function must not modify this value.  If it
-   can be determined that the value won't be modified, it need not make a copy;
-   otherwise a copy must be made.  */
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED)		\
-  frv_function_arg_callee_copies (&CUM, MODE, TYPE, NAMED)
-
 /* A C type for declaring a variable that is used as the first argument of
    `FUNCTION_ARG' and other related values.  For some target machines, the type
    `int' suffices and can hold the number of bytes of argument so far.
Index: gcc/config/iq2000/iq2000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/iq2000/iq2000.c,v
retrieving revision 1.26
diff -u -p -u -r1.26 iq2000.c
--- gcc/config/iq2000/iq2000.c	18 Aug 2004 08:24:35 -0000	1.26
+++ gcc/config/iq2000/iq2000.c	8 Sep 2004 18:31:32 -0000
@@ -199,6 +199,8 @@ static bool iq2000_pass_by_reference  (C
 #define TARGET_RETURN_IN_MEMORY		iq2000_return_in_memory
 #undef  TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE	iq2000_pass_by_reference
+#undef  TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES		hook_callee_copies_named
 
 #undef  TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS	iq2000_setup_incoming_varargs
Index: gcc/config/iq2000/iq2000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/iq2000/iq2000.h,v
retrieving revision 1.16
diff -u -p -u -r1.16 iq2000.h
--- gcc/config/iq2000/iq2000.h	14 Jul 2004 06:24:16 -0000	1.16
+++ gcc/config/iq2000/iq2000.h	8 Sep 2004 18:31:32 -0000
@@ -441,8 +441,6 @@ enum reg_class
 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
   function_arg_partial_nregs (& CUM, MODE, TYPE, NAMED)
 
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) (NAMED)
-
 #define MAX_ARGS_IN_REGISTERS 8
 
 typedef struct iq2000_args
Index: gcc/config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.107
diff -u -p -u -r1.107 m68hc11.c
--- gcc/config/m68hc11/m68hc11.c	31 Aug 2004 19:49:14 -0000	1.107
+++ gcc/config/m68hc11/m68hc11.c	8 Sep 2004 18:31:32 -0000
@@ -272,6 +272,8 @@ static int nb_soft_regs;
 #define TARGET_STRUCT_VALUE_RTX m68hc11_struct_value_rtx
 #undef TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY m68hc11_return_in_memory
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES hook_callee_copies_named
 
 #undef TARGET_STRIP_NAME_ENCODING
 #define TARGET_STRIP_NAME_ENCODING m68hc11_strip_name_encoding
Index: gcc/config/m68hc11/m68hc11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.h,v
retrieving revision 1.88
diff -u -p -u -r1.88 m68hc11.h
--- gcc/config/m68hc11/m68hc11.h	14 Jul 2004 06:24:18 -0000	1.88
+++ gcc/config/m68hc11/m68hc11.h	8 Sep 2004 18:31:33 -0000
@@ -1049,17 +1049,6 @@ typedef struct m68hc11_args
 #define PAD_VARARGS_DOWN \
   (m68hc11_function_arg_padding (TYPE_MODE (type), type) == downward)
 
-/* A C expression that indicates when it is the called function's
-   responsibility to make a copy of arguments passed by invisible
-   reference.  Normally, the caller makes a copy and passes the
-   address of the copy to the routine being called.  When
-   FUNCTION_ARG_CALLEE_COPIES is defined and is nonzero, the caller
-   does not make a copy.  Instead, it passes a pointer to the "live"
-   value.  The called function must not modify this value.  If it can
-   be determined that the value won't be modified, it need not make a
-   copy; otherwise a copy must be made.  */
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) (NAMED)
-
 /* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a
    function whose data type is FNTYPE. For a library call, FNTYPE is 0.  */
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.466
diff -u -p -u -r1.466 mips.c
--- gcc/config/mips/mips.c	7 Sep 2004 19:39:06 -0000	1.466
+++ gcc/config/mips/mips.c	8 Sep 2004 18:31:34 -0000
@@ -349,6 +349,8 @@ static tree mips_build_builtin_va_list (
 static tree mips_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 static bool mips_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode mode,
 				    tree, bool);
+static bool mips_callee_copies (CUMULATIVE_ARGS *, enum machine_mode mode,
+				tree, bool);
 static bool mips_vector_mode_supported_p (enum machine_mode);
 static rtx mips_prepare_builtin_arg (enum insn_code, unsigned int, tree *);
 static rtx mips_prepare_builtin_target (enum insn_code, unsigned int, rtx);
@@ -785,6 +787,8 @@ const struct mips_cpu_info mips_cpu_info
 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE mips_pass_by_reference
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES mips_callee_copies
 
 #undef TARGET_VECTOR_MODE_SUPPORTED_P
 #define TARGET_VECTOR_MODE_SUPPORTED_P mips_vector_mode_supported_p
@@ -6808,6 +6812,14 @@ mips_pass_by_reference (CUMULATIVE_ARGS 
     }
 }
 
+static bool
+mips_callee_copies (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
+		    enum machine_mode mode ATTRIBUTE_UNUSED,
+		    tree type ATTRIBUTE_UNUSED, bool named)
+{
+  return mips_abi == ABI_EABI && named;
+}
+
 /* Return the class of registers for which a mode change from FROM to TO
    is invalid.
 
Index: gcc/config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.366
diff -u -p -u -r1.366 mips.h
--- gcc/config/mips/mips.h	7 Sep 2004 19:39:06 -0000	1.366
+++ gcc/config/mips/mips.h	8 Sep 2004 18:31:34 -0000
@@ -2302,9 +2302,6 @@ typedef struct mips_args {
 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST)		\
   (mips_pad_reg_upward (MODE, TYPE) ? upward : downward)
 
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED)		\
-  (mips_abi == ABI_EABI && (NAMED))
-
 /* True if using EABI and varargs can be passed in floating-point
    registers.  Under these conditions, we need a more complex form
    of va_list, which tracks GPR, FPR and stack arguments separately.  */
Index: gcc/config/mmix/mmix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.c,v
retrieving revision 1.68
diff -u -p -u -r1.68 mmix.c
--- gcc/config/mmix/mmix.c	18 Aug 2004 17:05:09 -0000	1.68
+++ gcc/config/mmix/mmix.c	8 Sep 2004 18:31:35 -0000
@@ -206,6 +206,8 @@ static bool mmix_pass_by_reference (cons
 #define TARGET_SETUP_INCOMING_VARARGS mmix_setup_incoming_varargs
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE mmix_pass_by_reference
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
Index: gcc/config/mmix/mmix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.h,v
retrieving revision 1.67
diff -u -p -u -r1.67 mmix.h
--- gcc/config/mmix/mmix.h	14 Jul 2004 06:24:20 -0000	1.67
+++ gcc/config/mmix/mmix.h	8 Sep 2004 18:31:35 -0000
@@ -720,8 +720,6 @@ enum reg_class
 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)	\
  mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 1)
 
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
-
 typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
 
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
Index: gcc/config/mn10300/mn10300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300.c,v
retrieving revision 1.73
diff -u -p -u -r1.73 mn10300.c
--- gcc/config/mn10300/mn10300.c	14 Jul 2004 07:30:23 -0000	1.73
+++ gcc/config/mn10300/mn10300.c	8 Sep 2004 18:31:35 -0000
@@ -97,6 +97,8 @@ static bool mn10300_pass_by_reference (C
 #define TARGET_RETURN_IN_MEMORY mn10300_return_in_memory
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE mn10300_pass_by_reference
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 
 #undef TARGET_EXPAND_BUILTIN_SAVEREGS
 #define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs
Index: gcc/config/mn10300/mn10300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300.h,v
retrieving revision 1.82
diff -u -p -u -r1.82 mn10300.h
--- gcc/config/mn10300/mn10300.h	14 Jul 2004 06:24:20 -0000	1.82
+++ gcc/config/mn10300/mn10300.h	8 Sep 2004 18:31:35 -0000
@@ -610,8 +610,6 @@ struct cum_arg {int nbytes; };
 
 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
   function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
-
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
 
 /* Define how to find the value returned by a function.
    VALTYPE is the data type of the value (as a tree).
Index: gcc/config/pa/pa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.c,v
retrieving revision 1.275
diff -u -p -u -r1.275 pa.c
--- gcc/config/pa/pa.c	25 Aug 2004 17:49:57 -0000	1.275
+++ gcc/config/pa/pa.c	8 Sep 2004 18:31:36 -0000
@@ -280,6 +280,8 @@ static size_t n_deferred_plabels = 0;
 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE pa_pass_by_reference
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 
 #undef TARGET_EXPAND_BUILTIN_SAVEREGS
 #define TARGET_EXPAND_BUILTIN_SAVEREGS hppa_builtin_saveregs
Index: gcc/config/pa/pa.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa.h,v
retrieving revision 1.233
diff -u -p -u -r1.233 pa.h
--- gcc/config/pa/pa.h	25 Aug 2004 17:49:57 -0000	1.233
+++ gcc/config/pa/pa.h	8 Sep 2004 18:31:37 -0000
@@ -949,8 +949,6 @@ struct hppa_args {int words, nargs_proto
     : GET_MODE_SIZE(MODE) <= UNITS_PER_WORD)				\
    ? PARM_BOUNDARY : MAX_PARM_BOUNDARY)
 
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
-
 
 extern GTY(()) rtx hppa_compare_op0;
 extern GTY(()) rtx hppa_compare_op1;
Index: gcc/config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.296
diff -u -p -u -r1.296 sh.c
--- gcc/config/sh/sh.c	1 Sep 2004 00:28:30 -0000	1.296
+++ gcc/config/sh/sh.c	8 Sep 2004 18:31:38 -0000
@@ -283,6 +283,8 @@ static tree sh_build_builtin_va_list (vo
 static tree sh_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 static bool sh_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
 				  tree, bool);
+static bool sh_callee_copies (CUMULATIVE_ARGS *, enum machine_mode,
+			      tree, bool);
 
 
 /* Initialize the GCC target structure.  */
@@ -438,6 +440,8 @@ static bool sh_pass_by_reference (CUMULA
 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE sh_pass_by_reference
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES sh_callee_copies
 
 #undef TARGET_BUILD_BUILTIN_VA_LIST
 #define TARGET_BUILD_BUILTIN_VA_LIST sh_build_builtin_va_list
@@ -6609,6 +6613,18 @@ sh_pass_by_reference (CUMULATIVE_ARGS *c
   return false;
 }
 
+static bool
+sh_callee_copies (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+		  tree type, bool named ATTRIBUTE_UNUSED)
+{
+  /* ??? How can it possibly be correct to return true only on the
+     caller side of the equation?  Is there someplace else in the
+     sh backend that's magically producing the copies?  */
+  return (cum->outgoing
+	  && ((mode == BLKmode ? TYPE_ALIGN (type) : GET_MODE_ALIGNMENT (mode))
+	      % SH_MIN_ALIGN_FOR_CALLEE_COPY == 0));
+}
+
 /* Define where to put the arguments to a function.
    Value is zero to push the argument on the stack,
    or a hard register in which to store the argument.
Index: gcc/config/sh/sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.257
diff -u -p -u -r1.257 sh.h
--- gcc/config/sh/sh.h	25 Aug 2004 07:34:52 -0000	1.257
+++ gcc/config/sh/sh.h	8 Sep 2004 18:31:38 -0000
@@ -2197,12 +2197,6 @@ struct sh_args {
    boundaries, because they'll be loaded using quad loads.  */
 #define SH_MIN_ALIGN_FOR_CALLEE_COPY (8 * BITS_PER_UNIT)
 
-#define FUNCTION_ARG_CALLEE_COPIES(CUM,MODE,TYPE,NAMED) \
-  ((CUM).outgoing							\
-   && (((MODE) == BLKmode ? TYPE_ALIGN (TYPE)				\
-	: GET_MODE_ALIGNMENT (MODE))					\
-       % SH_MIN_ALIGN_FOR_CALLEE_COPY == 0))
-
 /* The SH5 ABI requires floating-point arguments to be passed to
    functions without a prototype in both an FP register and a regular
    register or the stack.  When passing the argument in both FP and
Index: gcc/config/v850/v850.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.c,v
retrieving revision 1.94
diff -u -p -u -r1.94 v850.c
--- gcc/config/v850/v850.c	20 Jul 2004 07:27:16 -0000	1.94
+++ gcc/config/v850/v850.c	8 Sep 2004 18:31:38 -0000
@@ -131,6 +131,9 @@ static int v850_interrupt_p = FALSE;
 #undef TARGET_PASS_BY_REFERENCE
 #define TARGET_PASS_BY_REFERENCE v850_pass_by_reference
 
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
+
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS v850_setup_incoming_varargs
 
Index: gcc/config/v850/v850.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.h,v
retrieving revision 1.97
diff -u -p -u -r1.97 v850.h
--- gcc/config/v850/v850.h	14 Jul 2004 06:24:27 -0000	1.97
+++ gcc/config/v850/v850.h	8 Sep 2004 18:31:39 -0000
@@ -773,8 +773,6 @@ struct cum_arg { int nbytes; int anonymo
    space allocated by the caller.  */
 #define OUTGOING_REG_PARM_STACK_SPACE
 
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
-
 /* 1 if N is a possible register number for function argument passing.  */
 
 #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9)
Index: gcc/doc/rtl.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/rtl.texi,v
retrieving revision 1.71
diff -u -p -u -r1.71 rtl.texi
--- gcc/doc/rtl.texi	8 Sep 2004 05:03:02 -0000	1.71
+++ gcc/doc/rtl.texi	8 Sep 2004 18:31:39 -0000
@@ -2959,8 +2959,8 @@ clobbered by the called function.
 
 A @code{MEM} generally points to a stack slots in which arguments passed
 to the libcall by reference (@pxref{Register Arguments,
-FUNCTION_ARG_PASS_BY_REFERENCE}) are stored.  If the argument is
-caller-copied (@pxref{Register Arguments, FUNCTION_ARG_CALLEE_COPIES}),
+TARGET_PASS_BY_REFERENCE}) are stored.  If the argument is
+caller-copied (@pxref{Register Arguments, TARGET_CALLEE_COPIES}),
 the stack slot will be mentioned in @code{CLOBBER} and @code{USE}
 entries; if it's callee-copied, only a @code{USE} will appear, and the
 @code{MEM} may point to addresses that are not stack slots.  These
Index: gcc/doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.365
diff -u -p -u -r1.365 tm.texi
--- gcc/doc/tm.texi	8 Sep 2004 00:17:19 -0000	1.365
+++ gcc/doc/tm.texi	8 Sep 2004 18:31:41 -0000
@@ -3733,16 +3733,18 @@ The pointer is passed in whatever way is
 to that type.
 @end deftypefn
 
-@defmac FUNCTION_ARG_CALLEE_COPIES (@var{cum}, @var{mode}, @var{type}, @var{named})
-If defined, a C expression that indicates when it is the called function's
-responsibility to make a copy of arguments passed by invisible reference.
-Normally, the caller makes a copy and passes the address of the copy to the
-routine being called.  When @code{FUNCTION_ARG_CALLEE_COPIES} is defined and is
-nonzero, the caller does not make a copy.  Instead, it passes a pointer to the
-``live'' value.  The called function must not modify this value.  If it can be
-determined that the value won't be modified, it need not make a copy;
-otherwise a copy must be made.
-@end defmac
+@deftypefn {Target Hook} bool TARGET_CALLEE_COPIES (CUMULATIVE_ARGS *@var{cum}, enum machine_mode @var{mode}, tree @var{type}, bool @var{named})
+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
+by the caller.
+
+For any argument for which the hook returns true, if it can be 
+determined that the argument is not modified, then a copy need
+not be generated.
+
+The default version of this hook always returns false.
+@end deftypefn
 
 @defmac CUMULATIVE_ARGS
 A C type for declaring a variable that is used as the first argument of


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]