OSDN Git Service

2008-05-07 Kai Tietz <kai,tietz@onevision.com>
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 May 2008 07:10:49 +0000 (07:10 +0000)
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 May 2008 07:10:49 +0000 (07:10 +0000)
* calls.c (compute_argument_block_size): Add argument tree fndecl.
(OUTGOING_REG_PARM_STACK_SPACE): Add function type argument.
(emit_library_call_value_1): Add new variable fndecl initialized by
NULL_TREE. It should be the decl type of orgfun, but this information
seems not to be available here, so it uses the default calling abi.
* config/arm/arm.c (arm_return_in_memory): Add fntype argumen.
* config/arm/arm.h (RETURN_IN_MEMORY): Replace RETURN_IN_MEMORY
by TARGET_RETURN_IN_MEMORY.
* config/i386/i386-interix.h: Likewise.
* config/i386/i386.h: Likewise.
* config/i386/i386elf.h: Likewise.
* config/i386/ptx4-i.h: Likewise.
* config/i386/sol2-10.h: Likewise.
* config/i386/sysv4.h: Likewise.
* config/i386/vx-common.h: Likewise.
* config/cris/cris.h: Removed #if 0 clause.
* config/arm/arm-protos.h (arm_return_in_memory): Add fntype
argument.
* config/i386/i386-protos.h (ix86_return_in_memory): Add fntype
argument.
(ix86_sol10_return_in_memory): Likewise.
(ix86_i386elf_return_in_memory): New.
(ix86_i386interix_return_in_memory): New.
* config/mt/mt-protos.h (mt_return_in_memory): New.
* config/mt/mt.c: Likewise.
* config/mt/mt.h (OUTGOING_REG_PARM_STACK_SPACE): Add FNTYPE argument.
(RETURN_IN_MEMORY):  Replace by TARGET_RETURN_IN_MEMORY.
* config/bfin/bfin.h: Likewise.
* config/bfin/bfin-protos.h (bfin_return_in_memory): Add fntype
argument.
* config/bfin/bfin.c: Likewise.
* config/pa/pa.h (OUTGOING_REG_PARM_STACK_SPACE): Add FNTYPE argument.
* config/alpha/unicosmk.h: Likewise.
* config/i386/cygming.h: Likewise.
* config/iq2000/iq2000.h: Likewise.
* config/mips/mips.h: Likewise.
* config/mn10300/mn10300.h: Likewise.
* config/rs6000/rs6000.h: Likewise.
* config/score/score.h: Likewise.
* config/spu/spu.h: Likewise.
* config/v850/v850.h: Likewise.
* defaults.h: Likewise.
* doc/tm.texi (OUTGOING_REG_PARM_STACK_SPACE): Adjust documentation.
* expr.c (emit_block_move): Adjust use of OUTGOING_REG_PARM_STACK_SPACE.
* function.c (STACK_DYNAMIC_OFFSET): Adjust use of
OUTGOING_REG_PARM_STACK_SPACE.
* targhooks.c (default_return_in_memory): Remove RETURN_IN_MEMORY.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135069 138bc75d-0d04-0410-961f-82ee72b054a4

38 files changed:
gcc/ChangeLog
gcc/calls.c
gcc/config/alpha/unicosmk.h
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/netbsd.h
gcc/config/bfin/bfin-protos.h
gcc/config/bfin/bfin.c
gcc/config/bfin/bfin.h
gcc/config/cris/cris.h
gcc/config/fr30/fr30.h
gcc/config/i386/cygming.h
gcc/config/i386/i386-interix.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i386/i386elf.h
gcc/config/i386/ptx4-i.h
gcc/config/i386/sol2-10.h
gcc/config/i386/sysv4.h
gcc/config/i386/vx-common.h
gcc/config/iq2000/iq2000.h
gcc/config/mips/mips.h
gcc/config/mn10300/mn10300.h
gcc/config/mt/mt-protos.h
gcc/config/mt/mt.c
gcc/config/mt/mt.h
gcc/config/pa/pa.h
gcc/config/rs6000/rs6000.h
gcc/config/score/score.h
gcc/config/spu/spu.h
gcc/config/v850/v850.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/expr.c
gcc/function.c
gcc/targhooks.c

index 1498db3..681dbb4 100644 (file)
@@ -1,3 +1,53 @@
+2008-05-08  Kai Tietz  <kai,tietz@onevision.com>
+
+       * calls.c (compute_argument_block_size): Add argument tree fndecl.
+       (OUTGOING_REG_PARM_STACK_SPACE): Add function type argument.
+       (emit_library_call_value_1): Add new variable fndecl initialized by
+       NULL_TREE. It should be the decl type of orgfun, but this information
+       seems not to be available here, so it uses the default calling abi.
+       * config/arm/arm.c (arm_return_in_memory): Add fntype argumen.
+       * config/arm/arm.h (RETURN_IN_MEMORY): Replace RETURN_IN_MEMORY
+       by TARGET_RETURN_IN_MEMORY.
+       * config/i386/i386-interix.h: Likewise.
+       * config/i386/i386.h: Likewise.
+       * config/i386/i386elf.h: Likewise.
+       * config/i386/ptx4-i.h: Likewise.
+       * config/i386/sol2-10.h: Likewise.
+       * config/i386/sysv4.h: Likewise.
+       * config/i386/vx-common.h: Likewise.
+       * config/cris/cris.h: Removed #if 0 clause.
+       * config/arm/arm-protos.h (arm_return_in_memory): Add fntype
+       argument.
+       * config/i386/i386-protos.h (ix86_return_in_memory): Add fntype
+       argument.
+       (ix86_sol10_return_in_memory): Likewise.
+       (ix86_i386elf_return_in_memory): New.
+       (ix86_i386interix_return_in_memory): New.
+       * config/mt/mt-protos.h (mt_return_in_memory): New.
+       * config/mt/mt.c: Likewise.
+       * config/mt/mt.h (OUTGOING_REG_PARM_STACK_SPACE): Add FNTYPE argument.
+       (RETURN_IN_MEMORY):  Replace by TARGET_RETURN_IN_MEMORY.
+       * config/bfin/bfin.h: Likewise.
+       * config/bfin/bfin-protos.h (bfin_return_in_memory): Add fntype
+       argument.
+       * config/bfin/bfin.c: Likewise.
+       * config/pa/pa.h (OUTGOING_REG_PARM_STACK_SPACE): Add FNTYPE argument.
+       * config/alpha/unicosmk.h: Likewise.
+       * config/i386/cygming.h: Likewise.
+       * config/iq2000/iq2000.h: Likewise.
+       * config/mips/mips.h: Likewise.
+       * config/mn10300/mn10300.h: Likewise.
+       * config/rs6000/rs6000.h: Likewise.
+       * config/score/score.h: Likewise.
+       * config/spu/spu.h: Likewise.
+       * config/v850/v850.h: Likewise.
+       * defaults.h: Likewise.
+       * doc/tm.texi (OUTGOING_REG_PARM_STACK_SPACE): Adjust documentation.
+       * expr.c (emit_block_move): Adjust use of OUTGOING_REG_PARM_STACK_SPACE.
+       * function.c (STACK_DYNAMIC_OFFSET): Adjust use of
+       OUTGOING_REG_PARM_STACK_SPACE.
+       * targhooks.c (default_return_in_memory): Remove RETURN_IN_MEMORY.
+
 2008-05-08  Jakub Jelinek  <jakub@redhat.com>
 
        * tree-parloops.c (create_parallel_loop): Set OMP_RETURN_NOWAIT
index 429ccb4..b382a72 100644 (file)
@@ -130,7 +130,7 @@ static void store_unaligned_arguments_into_pseudos (struct arg_data *, int);
 static int finalize_must_preallocate (int, int, struct arg_data *,
                                      struct args_size *);
 static void precompute_arguments (int, int, struct arg_data *);
-static int compute_argument_block_size (int, struct args_size *, int);
+static int compute_argument_block_size (int, struct args_size *, tree, int);
 static void initialize_argument_information (int, struct arg_data *,
                                             struct args_size *, int,
                                             tree, tree,
@@ -1189,6 +1189,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
 static int
 compute_argument_block_size (int reg_parm_stack_space,
                             struct args_size *args_size,
+                            tree fndecl,
                             int preferred_stack_boundary ATTRIBUTE_UNUSED)
 {
   int unadjusted_args_size = args_size->constant;
@@ -1226,7 +1227,7 @@ compute_argument_block_size (int reg_parm_stack_space,
 
          /* The area corresponding to register parameters is not to count in
             the size of the block we need.  So make the adjustment.  */
-         if (!OUTGOING_REG_PARM_STACK_SPACE)
+         if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))))
            args_size->var
              = size_binop (MINUS_EXPR, args_size->var,
                            ssize_int (reg_parm_stack_space));
@@ -1247,7 +1248,7 @@ compute_argument_block_size (int reg_parm_stack_space,
       args_size->constant = MAX (args_size->constant,
                                 reg_parm_stack_space);
 
-      if (!OUTGOING_REG_PARM_STACK_SPACE)
+      if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))))
        args_size->constant -= reg_parm_stack_space;
     }
   return unadjusted_args_size;
@@ -2065,7 +2066,8 @@ expand_call (tree exp, rtx target, int ignore)
   reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
 #endif
 
-  if (!OUTGOING_REG_PARM_STACK_SPACE && reg_parm_stack_space > 0 && PUSH_ARGS)
+  if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))
+      && reg_parm_stack_space > 0 && PUSH_ARGS)
     must_preallocate = 1;
 
   /* Set up a place to return a structure.  */
@@ -2394,6 +2396,7 @@ expand_call (tree exp, rtx target, int ignore)
       unadjusted_args_size
        = compute_argument_block_size (reg_parm_stack_space,
                                       &adjusted_args_size,
+                                      fndecl,
                                       (pass == 0 ? 0
                                        : preferred_stack_boundary));
 
@@ -2469,7 +2472,7 @@ expand_call (tree exp, rtx target, int ignore)
                  /* Since we will be writing into the entire argument area,
                     the map must be allocated for its entire size, not just
                     the part that is the responsibility of the caller.  */
-                 if (!OUTGOING_REG_PARM_STACK_SPACE)
+                 if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))))
                    needed += reg_parm_stack_space;
 
 #ifdef ARGS_GROW_DOWNWARD
@@ -2568,7 +2571,8 @@ expand_call (tree exp, rtx target, int ignore)
            {
              rtx push_size
                = GEN_INT (adjusted_args_size.constant
-                          + (OUTGOING_REG_PARM_STACK_SPACE ? 0
+                          + (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL
+                                                                     : TREE_TYPE (fndecl))) ? 0
                              : reg_parm_stack_space));
              if (old_stack_level == 0)
                {
@@ -2739,7 +2743,8 @@ expand_call (tree exp, rtx target, int ignore)
       /* If register arguments require space on the stack and stack space
         was not preallocated, allocate stack space here for arguments
         passed in registers.  */
-      if (OUTGOING_REG_PARM_STACK_SPACE && !ACCUMULATE_OUTGOING_ARGS
+      if (OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl)))
+          && !ACCUMULATE_OUTGOING_ARGS
          && must_preallocate == 0 && reg_parm_stack_space > 0)
        anti_adjust_stack (GEN_INT (reg_parm_stack_space));
 
@@ -3274,6 +3279,9 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
   struct args_size original_args_size;
   int argnum;
   rtx fun;
+  /* Todo, choose the correct decl type of orgfun. Sadly this information
+     isn't present here, so we default to native calling abi here.  */
+  tree fndecl = NULL_TREE; /* library calls default to host calling abi ? */
   int inc;
   int count;
   rtx argblock = 0;
@@ -3552,7 +3560,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
   args_size.constant = MAX (args_size.constant,
                            reg_parm_stack_space);
 
-  if (!OUTGOING_REG_PARM_STACK_SPACE)
+  if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))))
     args_size.constant -= reg_parm_stack_space;
 
   if (args_size.constant > crtl->outgoing_args_size)
@@ -3577,7 +3585,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
       /* Since we will be writing into the entire argument area, the
         map must be allocated for its entire size, not just the part that
         is the responsibility of the caller.  */
-      if (!OUTGOING_REG_PARM_STACK_SPACE)
+      if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? NULL_TREE : TREE_TYPE (fndecl))))
        needed += reg_parm_stack_space;
 
 #ifdef ARGS_GROW_DOWNWARD
index d08fa73..4a24bd5 100644 (file)
@@ -115,7 +115,7 @@ along with GCC; see the file COPYING3.  If not see
    in registers) are allocated.  */
 
 #define REG_PARM_STACK_SPACE(DECL) 48
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 /* If an argument can't be passed in registers even though not all argument
    registers have been used yet, it is passed on the stack in the space 
index 3a71744..e4540ec 100644 (file)
@@ -43,7 +43,7 @@ extern void arm_output_fn_unwind (FILE *, bool);
   
 
 #ifdef TREE_CODE
-extern int arm_return_in_memory (const_tree);
+extern int arm_return_in_memory (const_tree, const_tree);
 #endif
 #ifdef RTX_CODE
 extern bool arm_vector_mode_supported_p (enum machine_mode);
index 64f12a1..3a81172 100644 (file)
@@ -2736,9 +2736,9 @@ arm_apply_result_size (void)
 
 /* Decide whether a type should be returned in memory (true)
    or in a register (false).  This is called by the macro
-   RETURN_IN_MEMORY.  */
+   TARGET_RETURN_IN_MEMORY.  */
 int
-arm_return_in_memory (const_tree type)
+arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
   HOST_WIDE_INT size;
 
@@ -2801,7 +2801,7 @@ arm_return_in_memory (const_tree type)
 
       /* ... Aggregates that are not themselves valid for returning in
         a register are not allowed.  */
-      if (RETURN_IN_MEMORY (TREE_TYPE (field)))
+      if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
        return 1;
 
       /* Now check the remaining fields, if any.  Only bitfields are allowed,
@@ -2836,7 +2836,7 @@ arm_return_in_memory (const_tree type)
          if (FLOAT_TYPE_P (TREE_TYPE (field)))
            return 1;
 
-         if (RETURN_IN_MEMORY (TREE_TYPE (field)))
+         if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
            return 1;
        }
 
index b6e182c..7f10a57 100644 (file)
@@ -1481,7 +1481,7 @@ do {                                                                            \
 /* How large values are returned */
 /* A C expression which can inhibit the returning of certain function values
    in registers, based on the type of value.  */
-#define RETURN_IN_MEMORY(TYPE) arm_return_in_memory (TYPE)
+#define TARGET_RETURN_IN_MEMORY arm_return_in_memory
 
 /* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
    values must be in memory.  On the ARM, they need only do so if larger
index 33833cc..d9d39bd 100644 (file)
 /* Although not normally relevant (since by default, all aggregates
    are returned in memory) compiling some parts of libc requires
    non-APCS style struct returns.  */
-#undef RETURN_IN_MEMORY
+#undef TARGET_RETURN_IN_MEMORY
 
 /* VERY BIG NOTE : Change of structure alignment for RiscBSD.
    There are consequences you should be aware of...
index 1786f5c..1dc46f7 100644 (file)
@@ -120,7 +120,7 @@ extern void asm_conditional_branch (rtx, rtx *, int, int);
 extern rtx bfin_gen_compare (rtx, Mmode);
 
 extern int bfin_local_alignment (tree, int);
-extern int bfin_return_in_memory (const_tree);
+extern int bfin_return_in_memory (const_tree, const_tree);
 extern void initialize_trampoline (rtx, rtx, rtx);
 extern bool bfin_legitimate_address_p (Mmode, rtx, int);
 extern rtx bfin_va_arg (tree, tree);
index 87a1d93..e4c3f0c 100644 (file)
@@ -1840,10 +1840,10 @@ bfin_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
 
 /* Decide whether a type should be returned in memory (true)
    or in a register (false).  This is called by the macro
-   RETURN_IN_MEMORY.  */
+   TARGET_RETURN_IN_MEMORY.  */
 
 int
-bfin_return_in_memory (const_tree type)
+bfin_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
   int size = int_size_in_bytes (type);
   return size > 2 * UNITS_PER_WORD || size == -1;
index 3850c62..55a6b7d 100644 (file)
@@ -283,7 +283,7 @@ extern const char *bfin_library_id_string;
 
 /* Define this if the above stack space is to be considered part of the
  * space allocated by the caller.  */
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
          
 /* Define this if the maximum size of all the outgoing args is to be
    accumulated and pushed during the prologue.  The amount can be
@@ -841,7 +841,7 @@ typedef struct {
 #define FUNCTION_VALUE_REGNO_P(N) ((N) == REG_R0)
 
 #define DEFAULT_PCC_STRUCT_RETURN 0
-#define RETURN_IN_MEMORY(TYPE) bfin_return_in_memory(TYPE)
+#define TARGET_RETURN_IN_MEMORY bfin_return_in_memory
 
 /* Before the prologue, the return address is in the RETS register.  */
 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, REG_RETS)
index b8f4ae5..915c314 100644 (file)
@@ -923,14 +923,6 @@ struct cum_args {int regs;};
 
 /* Node: Aggregate Return */
 
-#if 0
-/* FIXME: Let's try this some time, so we return structures in registers.
-   We would cast the result of int_size_in_bytes to unsigned, so we will
-   get a huge number for "structures" of variable size (-1).  */
-#define RETURN_IN_MEMORY(TYPE) \
- ((unsigned) int_size_in_bytes (TYPE) > CRIS_MAX_ARGS_IN_REGS * UNITS_PER_WORD)
-#endif
-
 #define CRIS_STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1)
 
 
index 0f7592d..95bdcc3 100644 (file)
@@ -726,7 +726,7 @@ enum reg_class
    in memory.  Since this results in slower code, this should be defined only
    if needed for compatibility with other compilers or with an ABI.  If you
    define this macro to be 0, then the conventions used for structure and union
-   return values are decided by the `RETURN_IN_MEMORY' macro.
+   return values are decided by the `TARGET_RETURN_IN_MEMORY' macro.
 
    If not defined, this defaults to the value 1.  */
 #define DEFAULT_PCC_STRUCT_RETURN 1
index 65311da..a6537bc 100644 (file)
@@ -127,7 +127,7 @@ along with GCC; see the file COPYING3.  If not see
 #define REG_PARM_STACK_SPACE(FNDECL) (TARGET_64BIT_MS_ABI ? 32 : 0)
 
 #undef OUTGOING_REG_PARM_STACK_SPACE
-#define OUTGOING_REG_PARM_STACK_SPACE (TARGET_64BIT_MS_ABI ? 1 : 0)
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) (TARGET_64BIT_MS_ABI ? 1 : 0)
 
 #undef REGPARM_MAX
 #define REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : 3)
index 7015360..74e2892 100644 (file)
@@ -357,7 +357,5 @@ extern void i386_pe_unique_section (tree, int);
 
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
-  (TYPE_MODE (TYPE) == BLKmode || \
-     (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes(TYPE) > 8 ))
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY ix86_i386interix_return_in_memory
index 369953f..fd2e3c7 100644 (file)
@@ -134,9 +134,10 @@ extern rtx ix86_libcall_value (enum machine_mode);
 extern bool ix86_function_value_regno_p (int);
 extern bool ix86_function_arg_regno_p (int);
 extern int ix86_function_arg_boundary (enum machine_mode, tree);
-extern int ix86_return_in_memory (const_tree);
-extern int ix86_sol10_return_in_memory (const_tree);
-
+extern int ix86_return_in_memory (const_tree, const_tree);
+extern int ix86_sol10_return_in_memory (const_tree,const_tree);
+extern int ix86_i386elf_return_in_memory (const_tree,const_tree);
+extern int ix86_i386interix_return_in_memory (const_tree,const_tree);
 extern rtx ix86_force_to_memory (enum machine_mode, rtx);
 extern void ix86_free_from_memory (enum machine_mode);
 extern void ix86_split_fp_branch (enum rtx_code code, rtx, rtx,
index 7d254fe..0cb337f 100644 (file)
@@ -4902,7 +4902,7 @@ return_in_memory_ms_64 (const_tree type, enum machine_mode mode)
 }
 
 int
-ix86_return_in_memory (const_tree type)
+ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
   const enum machine_mode mode = type_natural_mode (type);
 
@@ -4920,7 +4920,7 @@ ix86_return_in_memory (const_tree type)
    are returned in memory, rather than in MMX registers.  */
 
 int
-ix86_sol10_return_in_memory (const_tree type)
+ix86_sol10_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
   int size;
   enum machine_mode mode = type_natural_mode (type);
@@ -4951,6 +4951,20 @@ ix86_sol10_return_in_memory (const_tree type)
   return size > 12;
 }
 
+int
+ix86_i386elf_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+{
+  return (TYPE_MODE (type) == BLKmode
+         || (VECTOR_MODE_P (TYPE_MODE (type)) && int_size_in_bytes (type) == 8));
+}
+
+int
+ix86_i386interix_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+{
+  return (TYPE_MODE (type) == BLKmode
+          || (AGGREGATE_TYPE_P (type) && int_size_in_bytes(type) > 8 ));
+}
+
 /* When returning SSE vector types, we have a choice of either
      (1) being abi incompatible with a -march switch, or
      (2) generating an error.
@@ -4959,7 +4973,7 @@ ix86_sol10_return_in_memory (const_tree type)
 
    Choose the STRUCT_VALUE_RTX hook because that's (at present) only
    called in response to actually generating a caller or callee that
-   uses such a type.  As opposed to RETURN_IN_MEMORY, which is called
+   uses such a type.  As opposed to TARGET_RETURN_IN_MEMORY, which is called
    via aggregate_value_p for general type probing from tree-ssa.  */
 
 static rtx
index bb6fa18..87815ed 100644 (file)
@@ -1278,8 +1278,7 @@ do {                                                                      \
    should always be returned in memory.  You should instead use
    `DEFAULT_PCC_STRUCT_RETURN' to indicate this.  */
 
-#define RETURN_IN_MEMORY(TYPE) \
-  ix86_return_in_memory (TYPE)
+#define TARGET_RETURN_IN_MEMORY ix86_return_in_memory
 
 /* This is overridden by <cygwin.h>.  */
 #define MS_AGGREGATE_RETURN 0
index cd42f88..6659669 100644 (file)
@@ -29,10 +29,8 @@ along with GCC; see the file COPYING3.  If not see
 /* The ELF ABI for the i386 says that records and unions are returned
    in memory.  */
 
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
-  (TYPE_MODE (TYPE) == BLKmode \
-   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY ix86_i386elf_return_in_memory
 
 #undef CPP_SPEC
 #define CPP_SPEC ""
index 3c46e6a..08473f0 100644 (file)
@@ -27,10 +27,8 @@ along with GCC; see the file COPYING3.  If not see
 /* The svr4 ABI for the i386 says that records and unions are returned
    in memory.  */
 
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
-  (TYPE_MODE (TYPE) == BLKmode \
-   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY ix86_i386elf_return_in_memory
 
 #define TARGET_OS_CPP_BUILTINS()               \
   do                                           \
index 92e2c6c..88b92f6 100644 (file)
@@ -110,5 +110,5 @@ along with GCC; see the file COPYING3.  If not see
 #undef TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
 
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY ix86_sol10_return_in_memory
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY ix86_sol10_return_in_memory
index e105272..e57fd0c 100644 (file)
@@ -25,10 +25,8 @@ along with GCC; see the file COPYING3.  If not see
 /* The svr4 ABI for the i386 says that records and unions are returned
    in memory.  */
 
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
-  (TYPE_MODE (TYPE) == BLKmode \
-   || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY ix86_i386elf_return_in_memory
 
 /* Output at beginning of assembler file.  */
 /* The .file command should always begin the output.  */
index 2544189..81530bc 100644 (file)
@@ -22,5 +22,5 @@ along with GCC; see the file COPYING3.  If not see
 
 /* VxWorks uses the same ABI as Solaris 10.  */
 
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY ix86_sol10_return_in_memory
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY ix86_sol10_return_in_memory
index cdbf5a2..f5574e4 100644 (file)
@@ -374,7 +374,7 @@ enum reg_class
 
 #define REG_PARM_STACK_SPACE(FNDECL) 0
 
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
 
index cda433a..1391c99 100644 (file)
@@ -1936,7 +1936,7 @@ enum reg_class
    If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect
    of this macro is to determine whether the space is included in
    `crtl->outgoing_args_size'.  */
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 #define STACK_BOUNDARY (TARGET_NEWABI ? 128 : 64)
 \f
index 8242275..1d2339b 100644 (file)
@@ -486,7 +486,7 @@ enum reg_class {
 /* We use d0/d1 for passing parameters, so allocate 8 bytes of space
    for a register flushback area.  */
 #define REG_PARM_STACK_SPACE(DECL) 8
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 #define ACCUMULATE_OUTGOING_ARGS 1
 
 /* So we can allocate space for return pointers once for the function
index 99717dc..2dcb945 100644 (file)
@@ -31,6 +31,7 @@ extern void       mt_add_loop          (void);
 extern const char * mt_cannot_inline_p  (tree);
 extern int          mt_function_arg_boundary (enum machine_mode, tree);
 extern void         mt_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree,  int);
+extern int mt_return_in_memory (const_tree,const_tree);
 #endif
 
 #ifdef RTX_CODE
index 272e028..c7fc0d1 100644 (file)
@@ -2460,6 +2460,13 @@ mt_machine_reorg (void)
       mt_reorg_hazard ();
     }
 }
+
+int
+mt_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+{
+  return (int_size_in_bytes (type) > UNITS_PER_WORD);
+}
+
 \f
 /* Initialize the GCC target structure.  */
 const struct attribute_spec mt_attribute_table[];
index de20d40..b587326 100644 (file)
@@ -532,7 +532,7 @@ extern struct mt_frame_info current_frame_info;
 
 /* Define this if it is the responsibility of the caller to
    allocate the area reserved for arguments passed in registers.  */
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 /* The number of register assigned to holding function arguments.  */
 #define MT_NUM_ARG_REGS        4
@@ -580,7 +580,7 @@ extern struct mt_frame_info current_frame_info;
 
 /* A C expression which can inhibit the returning of certain function
    values in registers, based on the type of value.  */
-#define RETURN_IN_MEMORY(TYPE) (int_size_in_bytes (TYPE) > UNITS_PER_WORD)
+#define TARGET_RETURN_IN_MEMORY mt_return_in_memory
 
 /* Define this macro to be 1 if all structure and union return values must be
    in memory.  */
index 541f2e3..22cd9f3 100644 (file)
@@ -549,7 +549,7 @@ extern struct rtx_def *hppa_pic_save_rtx (void);
 
 /* Define this if the above stack space is to be considered part of the
    space allocated by the caller.  */
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 /* Keep the stack pointer constant throughout the function.
    This is both an optimization and a necessity: longjmp
index 1bde282..7ec3d94 100644 (file)
@@ -1327,7 +1327,7 @@ extern enum rs6000_abi rs6000_current_abi;        /* available for use by subtarget */
 
 /* Define this if the above stack space is to be considered part of the
    space allocated by the caller.  */
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 /* This is the difference between the logical top of stack and the actual sp.
 
index fe6e6f9..78d2c57 100644 (file)
@@ -579,7 +579,7 @@ extern enum reg_class score_char_to_class[256];
    If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect
    of this macro is to determine whether the space is included in
    `crtl->outgoing_args_size'.  */
-#define OUTGOING_REG_PARM_STACK_SPACE   1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
 
index 3d038ca..729e0d7 100644 (file)
@@ -353,7 +353,7 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin;        \
 
 #define REG_PARM_STACK_SPACE(FNDECL) 0
 
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (0)
 
index 50119c2..b951b2c 100644 (file)
@@ -625,7 +625,7 @@ struct cum_arg { int nbytes; int anonymous_args; };
 
 /* Define this if the above stack space is to be considered part of the
    space allocated by the caller.  */
-#define OUTGOING_REG_PARM_STACK_SPACE 1
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 /* 1 if N is a possible register number for function argument passing.  */
 
index ef2dcb7..cc41b6e 100644 (file)
@@ -937,7 +937,7 @@ along with GCC; see the file COPYING3.  If not see
 #endif
 
 #ifndef OUTGOING_REG_PARM_STACK_SPACE
-#define OUTGOING_REG_PARM_STACK_SPACE 0
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 0
 #endif
 
 #endif  /* ! GCC_DEFAULTS_H */
index 3c01560..91448a7 100644 (file)
@@ -3819,9 +3819,11 @@ which.
 @c above is overfull.  not sure what to do.  --mew 5feb93  did
 @c something, not sure if it looks good.  --mew 10feb93
 
-@defmac OUTGOING_REG_PARM_STACK_SPACE
-Define this to a nonzero value if it is the responsibility of the caller
-to allocate the area reserved for arguments passed in registers.
+@defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype})
+Define this to a nonzero value if it is the responsibility of the
+caller to allocate the area reserved for arguments passed in registers
+when calling a function of @var{fntype}.  @var{fntype} may be NULL
+if the function called is a library function.
 
 If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
 whether the space for these arguments counts in the value of
index 141904f..ae25d40 100644 (file)
@@ -1259,6 +1259,10 @@ emit_block_move (rtx x, rtx y, rtx size, enum block_op_methods method)
 static bool
 block_move_libcall_safe_for_call_parm (void)
 {
+#if defined (REG_PARM_STACK_SPACE)
+  tree fn;
+#endif
+
   /* If arguments are pushed on the stack, then they're safe.  */
   if (PUSH_ARGS)
     return true;
@@ -1266,13 +1270,10 @@ block_move_libcall_safe_for_call_parm (void)
   /* If registers go on the stack anyway, any argument is sure to clobber
      an outgoing argument.  */
 #if defined (REG_PARM_STACK_SPACE)
-  if (OUTGOING_REG_PARM_STACK_SPACE)
-    {
-      tree fn;
-      fn = emit_block_move_libcall_fn (false);
-      if (REG_PARM_STACK_SPACE (fn) != 0)
-       return false;
-    }
+  fn = emit_block_move_libcall_fn (false);
+  if (OUTGOING_REG_PARM_STACK_SPACE ((!fn ? NULL_TREE : TREE_TYPE (fn)))
+      && REG_PARM_STACK_SPACE (fn) != 0)
+    return false;
 #endif
 
   /* If any argument goes in memory, then it might clobber an outgoing
index 5d70ddd..29d4c1e 100644 (file)
@@ -1147,7 +1147,8 @@ static int cfa_offset;
 #define STACK_DYNAMIC_OFFSET(FNDECL)   \
 ((ACCUMULATE_OUTGOING_ARGS                                                   \
   ? (crtl->outgoing_args_size                                \
-     + (OUTGOING_REG_PARM_STACK_SPACE ? 0 : REG_PARM_STACK_SPACE (FNDECL)))   \
+     + (OUTGOING_REG_PARM_STACK_SPACE ((!(FNDECL) ? NULL_TREE : TREE_TYPE (FNDECL))) ? 0 \
+                                              : REG_PARM_STACK_SPACE (FNDECL))) \
   : 0) + (STACK_POINTER_OFFSET))
 #else
 #define STACK_DYNAMIC_OFFSET(FNDECL)   \
@@ -3850,7 +3851,7 @@ allocate_struct_function (tree fndecl, bool abstract_p)
   if (init_machine_status)
     cfun->machine = (*init_machine_status) ();
 
-  if (fndecl != NULL)
+  if (fndecl != NULL_TREE)
     {
       DECL_STRUCT_FUNCTION (fndecl) = cfun;
       cfun->decl = fndecl;
index bfd1905..d719f5f 100644 (file)
@@ -107,11 +107,7 @@ bool
 default_return_in_memory (const_tree type,
                          const_tree fntype ATTRIBUTE_UNUSED)
 {
-#ifndef RETURN_IN_MEMORY
   return (TYPE_MODE (type) == BLKmode);
-#else
-  return RETURN_IN_MEMORY (type);
-#endif
 }
 
 rtx