OSDN Git Service

* builtins.c (std_gimplify_va_arg_expr): Handle types passed
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Jul 2004 08:43:41 +0000 (08:43 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Jul 2004 08:43:41 +0000 (08:43 +0000)
        by reference.
        (ind_gimplify_va_arg_expr): Remove.
        * tree.h (ind_gimplify_va_arg_expr): Remove.
        * config/pa/pa.c (hppa_gimplify_va_arg_expr): Don't use it.
        * config/mmix/mmix.c (mmix_function_arg_pass_by_reference): Allow
        argsp to be null.

        * config/arc/arc.c (arc_gimplify_va_arg_expr): Remove.
        (TARGET_GIMPLIFY_VA_ARG_EXPR): Remove.
        * config/cris/cris.c, config/fr30/fr30.c, config/frv/frv.c,
        config/iq2000/iq2000.c, config/m32r/m32r.c, config/mmix/mmix.c,
        config/mn10300/mn10300.c, config/v850/v850.c: Similarly.

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

13 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/config/arc/arc.c
gcc/config/cris/cris.c
gcc/config/fr30/fr30.c
gcc/config/frv/frv.c
gcc/config/iq2000/iq2000.c
gcc/config/m32r/m32r.c
gcc/config/mmix/mmix.c
gcc/config/mn10300/mn10300.c
gcc/config/pa/pa.c
gcc/config/v850/v850.c
gcc/tree.h

index 2a73f88..e2bc6de 100644 (file)
@@ -1,5 +1,21 @@
 2004-07-13  Richard Henderson  <rth@redhat.com>
 
+       * builtins.c (std_gimplify_va_arg_expr): Handle types passed
+       by reference.
+       (ind_gimplify_va_arg_expr): Remove.
+       * tree.h (ind_gimplify_va_arg_expr): Remove.
+       * config/pa/pa.c (hppa_gimplify_va_arg_expr): Don't use it.
+       * config/mmix/mmix.c (mmix_function_arg_pass_by_reference): Allow
+       argsp to be null.
+
+       * config/arc/arc.c (arc_gimplify_va_arg_expr): Remove.
+       (TARGET_GIMPLIFY_VA_ARG_EXPR): Remove.
+       * config/cris/cris.c, config/fr30/fr30.c, config/frv/frv.c,
+       config/iq2000/iq2000.c, config/m32r/m32r.c, config/mmix/mmix.c,
+       config/mn10300/mn10300.c, config/v850/v850.c: Similarly.
+
+2004-07-13  Richard Henderson  <rth@redhat.com>
+
        * function.c (pass_by_reference): New.
        (assign_parm_find_data_types): Use it.
        * calls.c (initialize_argument_information): Likewise.
index 147cefc..292f50d 100644 (file)
@@ -4477,6 +4477,7 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
 {
   tree addr, t, type_size, rounded_size, valist_tmp;
   unsigned HOST_WIDE_INT align, boundary;
+  bool indirect;
 
 #ifdef ARGS_GROW_DOWNWARD
   /* All of the alignment and movement below is for args-grow-up machines.
@@ -4485,6 +4486,10 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
   abort ();
 #endif
 
+  indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+  if (indirect)
+    type = build_pointer_type (type);
+
   align = PARM_BOUNDARY / BITS_PER_UNIT;
   boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type) / BITS_PER_UNIT;
 
@@ -4532,18 +4537,11 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
   gimplify_and_add (t, pre_p);
 
   addr = fold_convert (build_pointer_type (type), addr);
-  return build_fold_indirect_ref (addr);
-}
 
-/* Like std_gimplify_va_arg_expr, but uses pass-by-reference.  */
-tree
-ind_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  tree t;
-  t = build_pointer_type (type);
-  t = std_gimplify_va_arg_expr (valist, t, pre_p, post_p);
-  return build_fold_indirect_ref (t);
+  if (indirect)
+    addr = build_fold_indirect_ref (addr);
+
+  return build_fold_indirect_ref (addr);
 }
 
 /* Return a dummy expression of type TYPE in order to keep going after an
index 6f02cda..d648028 100644 (file)
@@ -102,7 +102,6 @@ static bool arc_rtx_costs (rtx, int, int, int *);
 static int arc_address_cost (rtx);
 static void arc_external_libcall (rtx);
 static bool arc_return_in_memory (tree, tree);
-static tree arc_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -142,8 +141,6 @@ static tree arc_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS arc_setup_incoming_varargs
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR arc_gimplify_va_arg_expr
 
 #undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE
 #define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE hook_int_void_1
@@ -2295,18 +2292,6 @@ arc_va_start (tree valist, rtx nextarg)
   std_expand_builtin_va_start (valist, nextarg);
 }
 
-static tree
-arc_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  /* All aggregates are passed by reference.  All scalar types larger
-     than 8 bytes are passed by reference.  */
-
-  if (AGGREGATE_TYPE_P (type) || int_size_in_bytes (type) > 8)
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-
-  return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-
 /* This is how to output a definition of an internal numbered label where
    PREFIX is the class of label and NUM is the number within the class.  */
 
index 4ca9cb9..b28896f 100644 (file)
@@ -116,8 +116,6 @@ static void cris_init_libfuncs (void);
 static bool cris_rtx_costs (rtx, int, int, int *);
 static int cris_address_cost (rtx);
 
-static tree cris_gimplify_va_arg_expr (tree, tree, tree *, tree *);
-
 /* The function cris_target_asm_function_epilogue puts the last insn to
    output here.  It always fits; there won't be a symbol operand.  Used in
    delay_slots_for_epilogue and function_epilogue.  */
@@ -191,8 +189,6 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS cris_setup_incoming_varargs
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR cris_gimplify_va_arg_expr
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -2789,18 +2785,6 @@ cris_init_libfuncs (void)
   set_optab_libfunc (umod_optab, SImode, "__Umod");
 }
 
-/* The va_arg gimplifier.  All we need to do here special is notice
-   when we we've got a pass-by-reference.  */
-
-static tree
-cris_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, dummy))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-
 /* The INIT_EXPANDERS worker sets the per-function-data initializer and
    mark functions.  */
 
index 017acfd..98e45c4 100644 (file)
@@ -123,7 +123,6 @@ static struct fr30_frame_info       zero_frame_info;
 
 static void fr30_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
                                         tree, int *, int);
-static tree fr30_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 static bool fr30_must_pass_in_stack (enum machine_mode, tree);
 
 #define FRAME_POINTER_MASK     (1 << (FRAME_POINTER_REGNUM))
@@ -158,9 +157,6 @@ static bool fr30_must_pass_in_stack (enum machine_mode, tree);
 #undef  TARGET_MUST_PASS_IN_STACK
 #define TARGET_MUST_PASS_IN_STACK fr30_must_pass_in_stack
 
-#undef  TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR fr30_gimplify_va_arg_expr
-
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Returns the number of bytes offset between FROM_REG and TO_REG
@@ -729,17 +725,6 @@ fr30_function_arg_partial_nregs (CUMULATIVE_ARGS cum, enum machine_mode mode,
   return FR30_NUM_ARG_REGS - cum;
 }
 
-/* Implement `va_arg'.  */
-
-static tree
-fr30_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, dummy))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-
 /*}}}*/
 /*{{{  Operand predicates */ 
 
index 4d05bd4..9935fef 100644 (file)
@@ -286,7 +286,6 @@ static void frv_output_const_unspec         (FILE *,
                                                 const struct frv_unspec *);
 static bool frv_function_ok_for_sibcall                (tree, tree);
 static rtx frv_struct_value_rtx                        (tree, int);
-static tree frv_gimplify_va_arg_expr           (tree, tree, tree *, tree *);
 static bool frv_must_pass_in_stack (enum machine_mode mode, tree type);
 \f
 /* Initialize the GCC target structure.  */
@@ -335,8 +334,6 @@ static bool frv_must_pass_in_stack (enum machine_mode mode, tree type);
 #define TARGET_EXPAND_BUILTIN_SAVEREGS frv_expand_builtin_saveregs
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS frv_setup_incoming_varargs
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR frv_gimplify_va_arg_expr
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -2085,18 +2082,6 @@ frv_expand_builtin_va_start (tree valist, rtx nextarg)
 }
 
 \f
-/* Expand __builtin_va_arg to do the va_arg macro.  */
-
-static tree
-frv_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (AGGREGATE_TYPE_P (type))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-
-\f
 /* Expand a block move operation, and return 1 if successful.  Return 0
    if we should let the compiler generate normal code.
 
index ac9b5d1..4da8712 100644 (file)
@@ -171,7 +171,6 @@ static bool iq2000_rtx_costs          (rtx, int, int, int *);
 static int  iq2000_address_cost       (rtx);
 static void iq2000_select_section     (tree, int, unsigned HOST_WIDE_INT);
 static bool iq2000_return_in_memory   (tree, tree);
-static tree iq2000_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 #undef  TARGET_INIT_BUILTINS
 #define TARGET_INIT_BUILTINS           iq2000_init_builtins
@@ -200,8 +199,6 @@ static tree iq2000_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 #define TARGET_SETUP_INCOMING_VARARGS  iq2000_setup_incoming_varargs
 #undef  TARGET_STRICT_ARGUMENT_NAMING
 #define TARGET_STRICT_ARGUMENT_NAMING  hook_bool_CUMULATIVE_ARGS_true
-#undef  TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR    iq2000_gimplify_va_arg_expr
 
 #undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE
 #define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE hook_int_void_1
@@ -1590,17 +1587,6 @@ iq2000_va_start (tree valist, rtx nextarg)
   nextarg = plus_constant (nextarg, - gpr_save_area_size);
   std_expand_builtin_va_start (valist, nextarg);
 }
-
-/* Implement va_arg.  */
-
-static tree
-iq2000_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (function_arg_pass_by_reference (NULL, TYPE_MODE (type), type, 0))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
 \f
 /* Allocate a chunk of memory for per-function machine-dependent data.  */
 
index 9bc3313..6c4a5dd 100644 (file)
@@ -99,7 +99,6 @@ static void m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
                                         tree, int *, int);
 static void init_idents (void);
 static bool m32r_rtx_costs (rtx, int, int, int *);
-static tree m32r_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 \f
 /* Initialize the GCC target structure.  */
 #undef  TARGET_ATTRIBUTE_TABLE
@@ -144,9 +143,6 @@ static tree m32r_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 #undef  TARGET_MUST_PASS_IN_STACK
 #define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
 
-#undef  TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR m32r_gimplify_va_arg_expr
-
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Called by OVERRIDE_OPTIONS to initialize various things.  */
@@ -1396,17 +1392,6 @@ m32r_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
 }
 
 \f
-/* Implement `va_arg'.  */
-
-static tree
-m32r_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (m32r_pass_by_reference (type))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-\f
 /* Return true if INSN is real instruction bearing insn.  */
 
 static int
index 569acc2..4e1731b 100644 (file)
@@ -139,7 +139,6 @@ static void mmix_file_start (void);
 static void mmix_file_end (void);
 static bool mmix_rtx_costs (rtx, int, int, int *);
 static rtx mmix_struct_value_rtx (tree, int);
-static tree mmix_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 
 /* Target structure macros.  Listed by node.  See `Using and Porting GCC'
@@ -205,8 +204,6 @@ static tree mmix_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS mmix_setup_incoming_varargs
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR mmix_gimplify_va_arg_expr
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -601,11 +598,15 @@ mmix_function_arg_pass_by_reference (const CUMULATIVE_ARGS *argsp,
 {
   /* FIXME: Check: I'm not sure the must_pass_in_stack check is
      necessary.  */
-  return
-    targetm.calls.must_pass_in_stack (mode, type)
-    || (MMIX_FUNCTION_ARG_SIZE (mode, type) > 8
-       && !TARGET_LIBFUNC
-       && !argsp->lib);
+  if (targetm.calls.must_pass_in_stack (mode, type))
+    return true;
+
+  if (MMIX_FUNCTION_ARG_SIZE (mode, type) > 8
+      && !TARGET_LIBFUNC
+      && (!argsp || !argsp->lib))
+    return true;
+
+  return false;
 }
 
 /* Return nonzero if regno is a register number where a parameter is
@@ -846,21 +847,6 @@ mmix_setup_incoming_varargs (CUMULATIVE_ARGS *args_so_farp,
     internal_error ("MMIX Internal: Last named vararg would not fit in a register");
 }
 
-/* Gimplify VA_ARG_EXPR.  All we need to do is figure out if TYPE is
-   pass-by-reference and hand off to standard routines.  */
-
-static tree
-mmix_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  CUMULATIVE_ARGS cum;
-  cum.lib = 0;
-
-  if (mmix_function_arg_pass_by_reference (&cum, TYPE_MODE (type), type, 0))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-
 /* TRAMPOLINE_SIZE.  */
 /* Four 4-byte insns plus two 8-byte values.  */
 int mmix_trampoline_size = 32;
index 22fc679..b5686c4 100644 (file)
@@ -71,7 +71,6 @@ static bool mn10300_rtx_costs (rtx, int, int, int *);
 static void mn10300_file_start (void);
 static bool mn10300_return_in_memory (tree, tree);
 static rtx mn10300_builtin_saveregs (void);
-static tree mn10300_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -98,8 +97,6 @@ static tree mn10300_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 #undef TARGET_EXPAND_BUILTIN_SAVEREGS
 #define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR mn10300_gimplify_va_arg_expr
 
 static void mn10300_encode_section_info (tree, rtx, int);
 struct gcc_target targetm = TARGET_INITIALIZER;
@@ -1459,15 +1456,6 @@ mn10300_va_start (tree valist, rtx nextarg)
   std_expand_builtin_va_start (valist, nextarg);
 }
 
-static tree
-mn10300_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, dummy))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-
 /* Return an RTX to represent where a value with mode MODE will be returned
    from a function.  If the result is 0, the argument is pushed.  */
 
index bbc27bd..723fbec 100644 (file)
@@ -5956,18 +5956,10 @@ hppa_va_start (tree valist, rtx nextarg)
 static tree
 hppa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
 {
-  bool indirect;
-
-  indirect = FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, 0);
-
   if (TARGET_64BIT)
     {
       /* Args grow upward.  We can use the generic routines.  */
-
-      if (indirect)
-       return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-      else
-       return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
+      return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
     }
   else /* !TARGET_64BIT */
     {
@@ -5975,7 +5967,9 @@ hppa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
       tree valist_type;
       tree t, u;
       unsigned int size, ofs;
+      bool indirect;
 
+      indirect = pass_by_reference (NULL, TYPE_MODE (type), type, 0);
       if (indirect)
        {
          type = ptr;
index 5a8c89f..7221bd7 100644 (file)
@@ -67,7 +67,6 @@ static void v850_encode_section_info (tree, rtx, int);
 static bool v850_return_in_memory    (tree, tree);
 static void v850_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
                                         tree, int *, int);
-static tree v850_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 /* Information about the various small memory areas.  */
 struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
@@ -133,9 +132,6 @@ static int v850_interrupt_p = FALSE;
 #undef TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS v850_setup_incoming_varargs
 
-#undef TARGET_GIMPLIFY_VA_ARG_EXPR
-#define TARGET_GIMPLIFY_VA_ARG_EXPR v850_gimplify_va_arg_expr
-
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Sometimes certain combinations of command options do not make
@@ -3308,17 +3304,6 @@ construct_prepare_instruction (rtx op)
   return buff;
 }
 \f
-/* Implement `va_arg'.  */
-
-static tree
-v850_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
-{
-  if (FUNCTION_ARG_PASS_BY_REFERENCE (dummy, TYPE_MODE (type), type, 0))
-    return ind_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-  else
-    return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);
-}
-\f
 /* Return an RTX indicating where the return address to the
    calling function can be found.  */
 
index d2b06b3..13f97ce 100644 (file)
@@ -3437,7 +3437,6 @@ extern tree strip_float_extensions (tree);
 extern tree simplify_builtin (tree, int);
 extern tree c_strlen (tree, int);
 extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
-extern tree ind_gimplify_va_arg_expr (tree, tree, tree *, tree *);
 
 /* In convert.c */
 extern tree strip_float_extensions (tree);