Makefile.in (explow.o, [...]): Depend on target.h.
authorRichard Guenther <rguenther@suse.de>
Thu, 14 Jul 2005 07:39:56 +0000 (07:39 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 14 Jul 2005 07:39:56 +0000 (07:39 +0000)
2005-07-14  Richard Guenther  <rguenther@suse.de>

* Makefile.in (explow.o, reg-stack.o): Depend on target.h.
* calls.c (expand_call): Pass fntype to hard_function_value.
(emit_library_call_value_1): Likewise.
* explow.c: Include target.h.
(hard_function_value): Take extra argument, the fntype.
Use new target hook for function_value.
* expr.h (hard_function_value): Change prototype.
* function.c (aggregate_value_p): Pass 0 as fntype to
hard_function_value.
(assign_parms): Use new target hook for function_value.
Pass 0 as fntype to hard_function_value.
(expand_function_end): Likewise.
* reg-stack.c: Include target.h.
(stack_result): Use new target hook for function_value.
* target-def.h: New target hook function_value.
* target.h: Likewise.
* targhooks.c (default_function_value): New function.
* targhooks.h (default_function_value): Declare.

From-SVN: r102013

gcc/ChangeLog
gcc/Makefile.in
gcc/calls.c
gcc/explow.c
gcc/expr.h
gcc/function.c
gcc/reg-stack.c
gcc/target-def.h
gcc/target.h
gcc/targhooks.c
gcc/targhooks.h

index 0bf41ce000b22bd21e316390c34fa64fec7ab749..126409f62478fc41f7127e787d53b96b02595dcd 100644 (file)
@@ -1,3 +1,24 @@
+2005-07-14  Richard Guenther  <rguenther@suse.de>
+
+       * Makefile.in (explow.o, reg-stack.o): Depend on target.h.
+       * calls.c (expand_call): Pass fntype to hard_function_value.
+       (emit_library_call_value_1): Likewise.
+       * explow.c: Include target.h.
+       (hard_function_value): Take extra argument, the fntype.
+       Use new target hook for function_value.
+       * expr.h (hard_function_value): Change prototype.
+       * function.c (aggregate_value_p): Pass 0 as fntype to
+       hard_function_value.
+       (assign_parms): Use new target hook for function_value.
+       Pass 0 as fntype to hard_function_value.
+       (expand_function_end): Likewise.
+       * reg-stack.c: Include target.h.
+       (stack_result): Use new target hook for function_value.
+       * target-def.h: New target hook function_value.
+       * target.h: Likewise.
+       * targhooks.c (default_function_value): New function.
+       * targhooks.h (default_function_value): Declare.
+
 2005-07-13  Ian Lance Taylor  <ian@airs.com>
 
        * config/mips/mips.h (CLZ_DEFINED_VALUE_AT_ZERO): Define.
index 1c70c7ab9b9e98219d3e08a614bb3577f1d884a3..2bc109238992b17033032f9788fc841509bebc90 100644 (file)
@@ -2079,7 +2079,7 @@ expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_
    toplev.h $(TM_P_H) langhooks.h
 explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
    $(FLAGS_H) hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
-   toplev.h function.h $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h
+   toplev.h function.h $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h target.h
 optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h \
    $(RECOG_H) reload.h toplev.h $(GGC_H) real.h $(TM_P_H) except.h \
@@ -2391,7 +2391,8 @@ recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
 reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(RTL_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
    insn-config.h toplev.h reload.h function.h $(TM_P_H) $(GGC_H) \
-   gt-reg-stack.h $(BASIC_BLOCK_H) output.h $(VARRAY_H) timevar.h tree-pass.h
+   gt-reg-stack.h $(BASIC_BLOCK_H) output.h $(VARRAY_H) timevar.h tree-pass.h \
+   target.h
 sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h
 predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) \
index 1613e883746e5e7f210b36c55a3ce2491c139967..89f747fe2eb7a549d61995de108e3a1581ef03aa 100644 (file)
@@ -2517,9 +2517,10 @@ expand_call (tree exp, rtx target, int ignore)
        {
          if (pcc_struct_value)
            valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
-                                         fndecl, (pass == 0));
+                                         fndecl, NULL, (pass == 0));
          else
-           valreg = hard_function_value (TREE_TYPE (exp), fndecl, (pass == 0));
+           valreg = hard_function_value (TREE_TYPE (exp), fndecl, fntype,
+                                         (pass == 0));
        }
 
       /* Precompute all register parameters.  It isn't safe to compute anything
@@ -3266,7 +3267,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
        {
 #ifdef PCC_STATIC_STRUCT_RETURN
          rtx pointer_reg
-           = hard_function_value (build_pointer_type (tfom), 0, 0);
+           = hard_function_value (build_pointer_type (tfom), 0, 0, 0);
          mem_value = gen_rtx_MEM (outmode, pointer_reg);
          pcc_struct_value = 1;
          if (value == 0)
index 510525edca67a94c99a0998e037f3f1681e2c6f5..23b124fbbb596fef8e55f42344254d3c832d9ccd 100644 (file)
@@ -37,6 +37,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #include "ggc.h"
 #include "recog.h"
 #include "langhooks.h"
+#include "target.h"
 
 static rtx break_out_memory_refs (rtx);
 static void emit_stack_probe (rtx);
@@ -1405,24 +1406,19 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
 /* Return an rtx representing the register or memory location
    in which a scalar value of data type VALTYPE
    was returned by a function call to function FUNC.
-   FUNC is a FUNCTION_DECL node if the precise function is known,
-   otherwise 0.
+   FUNC is a FUNCTION_DECL, FNTYPE a FUNCTION_TYPE node if the precise
+   function is known, otherwise 0.
    OUTGOING is 1 if on a machine with register windows this function
    should return the register in which the function will put its result
    and 0 otherwise.  */
 
 rtx
-hard_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
+hard_function_value (tree valtype, tree func, tree fntype,
                     int outgoing ATTRIBUTE_UNUSED)
 {
   rtx val;
 
-#ifdef FUNCTION_OUTGOING_VALUE
-  if (outgoing)
-    val = FUNCTION_OUTGOING_VALUE (valtype, func);
-  else
-#endif
-    val = FUNCTION_VALUE (valtype, func);
+  val = targetm.calls.function_value (valtype, func ? func : fntype, outgoing);
 
   if (REG_P (val)
       && GET_MODE (val) == BLKmode)
index 31c43c087d2943e5c008e9e2bcf7142d844f8c6a..224e2857f2b9ad601bd2a64501b8ae96b09b80c9 100644 (file)
@@ -550,7 +550,7 @@ extern HOST_WIDE_INT int_expr_size (tree);
 
 /* Return an rtx that refers to the value returned by a function
    in its original home.  This becomes invalid if any more code is emitted.  */
-extern rtx hard_function_value (tree, tree, int);
+extern rtx hard_function_value (tree, tree, tree, int);
 
 extern rtx prepare_call_address (rtx, rtx, rtx *, int, int);
 
index 3fcc8b86089c86bd356e82169053070e89bff670..160c80dfaa0dee63857e8bb435eaef0c5dc33e6b 100644 (file)
@@ -1732,7 +1732,7 @@ aggregate_value_p (tree exp, tree fntype)
     return 1;
   /* Make sure we have suitable call-clobbered regs to return
      the value in; if not, we must return it in memory.  */
-  reg = hard_function_value (type, 0, 0);
+  reg = hard_function_value (type, 0, fntype, 0);
 
   /* If we have something other than a REG (e.g. a PARALLEL), then assume
      it is OK.  */
@@ -3055,13 +3055,8 @@ assign_parms (tree fndecl)
        {
          rtx real_decl_rtl;
 
-#ifdef FUNCTION_OUTGOING_VALUE
-         real_decl_rtl = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl_result),
-                                                  fndecl);
-#else
-         real_decl_rtl = FUNCTION_VALUE (TREE_TYPE (decl_result),
-                                         fndecl);
-#endif
+         real_decl_rtl = targetm.calls.function_value (TREE_TYPE (decl_result),
+                                                       fndecl, true);
          REG_FUNCTION_VALUE_P (real_decl_rtl) = 1;
          /* The delay slot scheduler assumes that current_function_return_rtx
             holds the hard register containing the return value, not a
@@ -4149,7 +4144,7 @@ expand_function_start (tree subr)
          /* In order to figure out what mode to use for the pseudo, we
             figure out what the mode of the eventual return register will
             actually be, and use that.  */
-         rtx hard_reg = hard_function_value (return_type, subr, 1);
+         rtx hard_reg = hard_function_value (return_type, subr, 0, 1);
 
          /* Structures that are returned in registers are not
             aggregate_value_p, so we may see a PARALLEL or a REG.  */
@@ -4499,13 +4494,8 @@ expand_function_end (void)
       else
        value_address = XEXP (value_address, 0);
 
-#ifdef FUNCTION_OUTGOING_VALUE
-      outgoing = FUNCTION_OUTGOING_VALUE (build_pointer_type (type),
-                                         current_function_decl);
-#else
-      outgoing = FUNCTION_VALUE (build_pointer_type (type),
-                                current_function_decl);
-#endif 
+      outgoing = targetm.calls.function_value (build_pointer_type (type),
+                                              current_function_decl, true);
 
       /* Mark this as a function return value so integrate will delete the
         assignment and USE below when inlining this function.  */
index d1d8b9894bde2308378153e42940d1d393b53e45..9f44f5180954714920022bd575e0356ee02a3e9a 100644 (file)
 #include "ggc.h"
 #include "timevar.h"
 #include "tree-pass.h"
+#include "target.h"
 
 /* We use this array to cache info about insns, because otherwise we
    spend too much time in stack_regs_mentioned_p.
@@ -667,14 +668,8 @@ stack_result (tree decl)
 
   result = DECL_RTL_IF_SET (DECL_RESULT (decl));
   if (result != 0)
-    {
-#ifdef FUNCTION_OUTGOING_VALUE
-      result
-       = FUNCTION_OUTGOING_VALUE (TREE_TYPE (DECL_RESULT (decl)), decl);
-#else
-      result = FUNCTION_VALUE (TREE_TYPE (DECL_RESULT (decl)), decl);
-#endif
-    }
+    result = targetm.calls.function_value (TREE_TYPE (DECL_RESULT (decl)),
+                                          decl, true);
 
   return result != 0 && STACK_REG_P (result) ? result : 0;
 }
index 6f8470e4aec52b9b21a4b6e681cdcbd0cb7ddcef..a9921c7409aa73bc6e2f97be4287f530f6992e6e 100644 (file)
@@ -438,6 +438,8 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
 #define TARGET_ARG_PARTIAL_BYTES hook_int_CUMULATIVE_ARGS_mode_tree_bool_0
 
+#define TARGET_FUNCTION_VALUE default_function_value
+
 #define TARGET_CALLS {                                         \
    TARGET_PROMOTE_FUNCTION_ARGS,                               \
    TARGET_PROMOTE_FUNCTION_RETURN,                             \
@@ -454,7 +456,8 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    TARGET_MUST_PASS_IN_STACK,                                  \
    TARGET_CALLEE_COPIES,                                       \
    TARGET_ARG_PARTIAL_BYTES,                                   \
-   TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN                      \
+   TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN,                     \
+   TARGET_FUNCTION_VALUE                                       \
    }
 
 #ifndef TARGET_UNWIND_TABLES_DEFAULT
index 1b3aaf0cfc0ed9fdb967a5f029be5601440e274b..564c333136c6416cd8416b3714f84101edbc8eb2 100644 (file)
@@ -603,6 +603,11 @@ struct gcc_target
        is not allowed for this 'val' argument; NULL otherwise. */
     const char *(*invalid_arg_for_unprototyped_fn) (tree typelist, 
                                                    tree funcdecl, tree val);
+
+    /* Return an rtx for the return value location of the function
+       specified by FN_DECL_OR_TYPE with a return type of RET_TYPE.  */
+    rtx (*function_value) (tree ret_type, tree fn_decl_or_type,
+                          bool outgoing);
   } calls;
 
   /* Return the diagnostic message string if conversion from FROMTYPE
index 4fc6e10a30b38c86369d566f2b083d5fff9a33df..c0c42019a04a6bee45a48af7e7563606a1acf167 100644 (file)
@@ -417,4 +417,26 @@ hook_bool_rtx_commutative_p (rtx x, int outer_code ATTRIBUTE_UNUSED)
   return COMMUTATIVE_P (x);
 }
 
+rtx
+default_function_value (tree ret_type ATTRIBUTE_UNUSED,
+                       tree fn_decl_or_type,
+                       bool outgoing ATTRIBUTE_UNUSED)
+{
+  /* The old interface doesn't handle receiving the function type.  */
+  if (fn_decl_or_type
+      && !DECL_P (fn_decl_or_type))
+    fn_decl_or_type = NULL;
+
+#ifdef FUNCTION_OUTGOING_VALUE
+  if (outgoing)
+    return FUNCTION_OUTGOING_VALUE (ret_type, fn_decl_or_type);
+#endif
+
+#ifdef FUNCTION_VALUE
+  return FUNCTION_VALUE (ret_type, fn_decl_or_type);
+#else
+  return NULL_RTX;
+#endif
+}
+
 #include "gt-targhooks.h"
index ad526482ff2f5c113d3b4536ca1c58b03a0afa9e..a39d27df33707ae69ea024759583d6ded7b73390 100644 (file)
@@ -67,3 +67,5 @@ extern int hook_int_CUMULATIVE_ARGS_mode_tree_bool_0
 extern const char *hook_invalid_arg_for_unprototyped_fn
   (tree, tree, tree);
 extern bool hook_bool_rtx_commutative_p (rtx, int);
+extern rtx default_function_value (tree, tree, bool);
+