sparc-protos.h: Remove the prototype for sparc_builtin_saveregs.
authorKazu Hirata <kazu@cs.umass.edu>
Fri, 30 Jan 2004 14:46:43 +0000 (14:46 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 30 Jan 2004 14:46:43 +0000 (14:46 +0000)
* config/sparc/sparc-protos.h: Remove the prototype for
sparc_builtin_saveregs.
* config/sparc/sparc.c (TARGET_PROMOTE_FUNCTION_ARGS): New.
(TARGET_PROMOTE_FUNCTION_RETURN): Likewise.
(TARGET_PROMOTE_PROTOTYPES): Likewise.
(TARGET_STRUCT_VALUE_RTX): Likewise.
(TARGET_RETURN_IN_MEMORY): Likewise.
(TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise.
(TARGET_STRICT_ARGUMENT_NAMING): Likewise.
(sparc_builtin_saveregs): Make it static.
(sparc_promote_prototypes): New.
(sparc_struct_value_rtx): Likewise.
(sparc_return_in_memory): Likewise.
* config/sparc/sparc.h: (PROMOTE_FUNCTION_ARGS): Remove.
(PROMOTE_FUNCTION_RETURN): Likewise.
(RETURN_IN_MEMORY): Likewise.
(STRUCT_VALUE): Likewise.
(STRUCT_VALUE_INCOMING): Likewise.
(EXPAND_BUILTIN_SAVEREGS): Likewise.
(STRICT_ARGUMENT_NAMING): Likewise.
(PROMOTE_PROTOTYPES): Likewise.

* config/sparc/sparc.h (PROMOTE_MODE): Use word_mode.

Co-Authored-By: Eric Botcazou <ebotcazou@libertysurf.fr>
From-SVN: r76961

gcc/ChangeLog
gcc/config/sparc/sparc-protos.h
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h

index 834142a7f64b8ab037a47be459b82fcf5b3b51ac..115979032b0b7df766e5fa9e80d849ae152bd5f5 100644 (file)
@@ -1,3 +1,30 @@
+2004-01-30  Kazu Hirata  <kazu@cs.umass.edu>
+            Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * config/sparc/sparc-protos.h: Remove the prototype for
+       sparc_builtin_saveregs.
+       * config/sparc/sparc.c (TARGET_PROMOTE_FUNCTION_ARGS): New.
+       (TARGET_PROMOTE_FUNCTION_RETURN): Likewise.
+       (TARGET_PROMOTE_PROTOTYPES): Likewise.
+       (TARGET_STRUCT_VALUE_RTX): Likewise.
+       (TARGET_RETURN_IN_MEMORY): Likewise.
+       (TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise.
+       (TARGET_STRICT_ARGUMENT_NAMING): Likewise.
+       (sparc_builtin_saveregs): Make it static.
+       (sparc_promote_prototypes): New.
+       (sparc_struct_value_rtx): Likewise.
+       (sparc_return_in_memory): Likewise.
+       * config/sparc/sparc.h: (PROMOTE_FUNCTION_ARGS): Remove.
+       (PROMOTE_FUNCTION_RETURN): Likewise.
+       (RETURN_IN_MEMORY): Likewise.
+       (STRUCT_VALUE): Likewise.
+       (STRUCT_VALUE_INCOMING): Likewise.
+       (EXPAND_BUILTIN_SAVEREGS): Likewise.
+       (STRICT_ARGUMENT_NAMING): Likewise.
+       (PROMOTE_PROTOTYPES): Likewise.
+
+       * config/sparc/sparc.h (PROMOTE_MODE): Use word_mode.
+
 2004-01-30  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR c/12818
index 12c5d2d8969356ced19e2303fe2fe6d0ff3ea4f8..35f5d51dd89fcef030d129e25a729b7dcde64447 100644 (file)
@@ -1,5 +1,5 @@
 /* Prototypes of target machine for SPARC.
-   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com).
    64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
    at Cygnus Support.
@@ -36,7 +36,6 @@ extern int function_arg_partial_nregs (const CUMULATIVE_ARGS *,
                                       enum machine_mode, tree, int);
 extern int function_arg_pass_by_reference (const CUMULATIVE_ARGS *,
                                           enum machine_mode, tree, int);
-extern struct rtx_def *sparc_builtin_saveregs (void);
 #ifdef RTX_CODE
 extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
 extern void sparc_va_start (tree, rtx);
index e1e37eec0b9e43f0b961b6d89b364a6373b550bb..8beea5248ebcaa69d0baeeb86439399da73e1230 100644 (file)
@@ -148,6 +148,7 @@ static void sparc_output_addr_vec (rtx);
 static void sparc_output_addr_diff_vec (rtx);
 static void sparc_output_deferred_case_vectors (void);
 static int check_return_regs (rtx);
+static rtx sparc_builtin_saveregs (void);
 static int epilogue_renumber (rtx *, int);
 static bool sparc_assemble_integer (rtx, unsigned int, int);
 static int set_extends (rtx);
@@ -194,6 +195,10 @@ static rtx sparc_tls_got (void);
 static const char *get_some_local_dynamic_name (void);
 static int get_some_local_dynamic_name_1 (rtx *, void *);
 static bool sparc_rtx_costs (rtx, int, int, int *);
+static bool sparc_promote_prototypes (tree);
+static rtx sparc_struct_value_rtx (tree, int);
+static bool sparc_return_in_memory (tree, tree);
+static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *);
 \f
 /* Option handling.  */
 
@@ -277,6 +282,36 @@ enum processor_type sparc_cpu;
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST hook_int_rtx_0
 
+/* Return TRUE if the promotion described by PROMOTE_MODE should also be done
+   for outgoing function arguments.
+   This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
+   for TARGET_ARCH32 this is ok.  Otherwise we'd need to add a runtime test
+   for this value.  */
+#undef TARGET_PROMOTE_FUNCTION_ARGS
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+
+/* Return TRUE if the promotion described by PROMOTE_MODE should also be done
+   for the return value of functions.  If this macro is defined, FUNCTION_VALUE
+   must perform the same promotions done by PROMOTE_MODE.
+   This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
+   for TARGET_ARCH32 this is ok.  Otherwise we'd need to add a runtime test
+   for this value.  */
+#undef TARGET_PROMOTE_FUNCTION_RETURN
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+
+#undef TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES sparc_promote_prototypes
+
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX sparc_struct_value_rtx
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY sparc_return_in_memory
+
+#undef TARGET_EXPAND_BUILTIN_SAVEREGS
+#define TARGET_EXPAND_BUILTIN_SAVEREGS sparc_builtin_saveregs
+#undef TARGET_STRICT_ARGUMENT_NAMING
+#define TARGET_STRICT_ARGUMENT_NAMING sparc_strict_argument_naming
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Validate and override various options, and do some machine dependent
@@ -4817,6 +4852,60 @@ init_cumulative_args (struct sparc_args *cum, tree fntype,
   cum->libcall_p = fntype == 0;
 }
 
+/* Handle the PROMOTE_PROTOTYPES macro.
+   When a prototype says `char' or `short', really pass an `int'.  */
+
+static bool
+sparc_promote_prototypes (tree fntype ATTRIBUTE_UNUSED)
+{
+  return TARGET_ARCH32 ? true : false;
+}
+
+/* Handle the STRICT_ARGUMENT_NAMING macro.  */
+
+static bool
+sparc_strict_argument_naming (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED)
+{
+  /* For the V9 we want NAMED to mean what it says it means.  */
+  return TARGET_V9 ? true : false;
+}
+
+/* Handle the RETURN_IN_MEMORY macro.
+   Specify whether to return the return value in memory.  */
+
+static bool
+sparc_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+  /* SPARC ABI says that quad-precision floats and all structures are
+     returned in memory.
+     For V9: unions <= 32 bytes in size are returned in int regs,
+     structures up to 32 bytes are returned in int and fp regs.  */
+  return (TARGET_ARCH32
+         ? (TYPE_MODE (type) == BLKmode
+            || TYPE_MODE (type) == TFmode)
+         : (TYPE_MODE (type) == BLKmode
+            && (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 32));
+}
+
+/* Handle the STRUCT_VALUE macro.
+   Return where to find the structure return value address.  */
+
+static rtx
+sparc_struct_value_rtx (tree fndecl ATTRIBUTE_UNUSED, int incoming)
+{
+  if (TARGET_ARCH64)
+    return 0;
+  else
+    {
+      if (incoming)
+       return gen_rtx_MEM (Pmode, plus_constant (frame_pointer_rtx,
+                                                 STRUCT_VALUE_OFFSET));
+      else
+       return gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx,
+                                                 STRUCT_VALUE_OFFSET));
+    }
+}
+
 /* Scan the record type TYPE and return the following predicates:
     - INTREGS_P: the record contains at least one field or sub-field
       that is eligible for promotion in integer registers.
@@ -5730,7 +5819,7 @@ function_value (tree type, enum machine_mode mode, int incoming_p)
    to determine if stdarg or varargs is used and return the address of
    the first unnamed parameter.  */
 
-rtx
+static rtx
 sparc_builtin_saveregs (void)
 {
   int first_reg = current_function_args_info.words;
index 364bea099e39eb14ec4e1a5f3b7c32371bebe1ce..194fcb61af8f64cfe88663b8b7dd039f8e352dca 100644 (file)
@@ -1,8 +1,8 @@
 /* Definitions of target machine for GNU compiler, for Sun SPARC.
    Copyright (C) 1987, 1988, 1989, 1992, 1994, 1995, 1996, 1997, 1998, 1999
-   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com).
-   64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
+   64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
    at Cygnus Support.
 
 This file is part of GCC.
@@ -746,23 +746,7 @@ extern struct sparc_cpu_select sparc_select[];
 if (TARGET_ARCH64                              \
     && GET_MODE_CLASS (MODE) == MODE_INT       \
     && GET_MODE_SIZE (MODE) < UNITS_PER_WORD)  \
-  (MODE) = DImode;
-
-/* Define this macro if the promotion described by PROMOTE_MODE
-   should also be done for outgoing function arguments.  */
-/* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
-   for TARGET_ARCH32 this is ok.  Otherwise we'd need to add a runtime test
-   for this value.  */
-#define PROMOTE_FUNCTION_ARGS
-
-/* Define this macro if the promotion described by PROMOTE_MODE
-   should also be done for the return value of functions.
-   If this macro is defined, FUNCTION_VALUE must perform the same
-   promotions done by PROMOTE_MODE.  */
-/* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op
-   for TARGET_ARCH32 this is ok.  Otherwise we'd need to add a runtime test
-   for this value.  */
-#define PROMOTE_FUNCTION_RETURN
+  (MODE) = word_mode;
 
 /* Define this macro if the promotion described by PROMOTE_MODE
    should _only_ be performed for outgoing function arguments or
@@ -1149,37 +1133,12 @@ extern int sparc_mode_class[];
 
 #define DEFAULT_PCC_STRUCT_RETURN -1
 
-/* SPARC ABI says that quad-precision floats and all structures are returned
-   in memory.
-   For v9: unions <= 32 bytes in size are returned in int regs,
-   structures up to 32 bytes are returned in int and fp regs.  */
-
-#define RETURN_IN_MEMORY(TYPE)                         \
-(TARGET_ARCH32                                         \
- ? (TYPE_MODE (TYPE) == BLKmode                                \
-    || TYPE_MODE (TYPE) == TFmode)                     \
- : (TYPE_MODE (TYPE) == BLKmode                                \
-    && (unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) > 32))
-
 /* Functions which return large structures get the address
    to place the wanted value at offset 64 from the frame.
    Must reserve 64 bytes for the in and local registers.
    v9: Functions which return large structures get the address to place the
    wanted value from an invisible first argument.  */
-/* Used only in other #defines in this file.  */
 #define STRUCT_VALUE_OFFSET 64
-
-#define STRUCT_VALUE \
-  (TARGET_ARCH64                                       \
-   ? 0                                                 \
-   : gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \
-                                       STRUCT_VALUE_OFFSET)))
-
-#define STRUCT_VALUE_INCOMING \
-  (TARGET_ARCH64                                               \
-   ? 0                                                         \
-   : gen_rtx_MEM (Pmode, plus_constant (frame_pointer_rtx,     \
-                                       STRUCT_VALUE_OFFSET)))
 \f
 /* Define the classes of registers for register constraints in the
    machine description.  Also define ranges of constants.
@@ -1954,10 +1913,6 @@ do {                                                                     \
     else                                                       \
       sparc_initialize_trampoline (TRAMP, FNADDR, CXT)
 \f
-/* Generate necessary RTL for __builtin_saveregs().  */
-
-#define EXPAND_BUILTIN_SAVEREGS() sparc_builtin_saveregs ()
-
 /* Implement `va_start' for varargs and stdarg.  */
 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
   sparc_va_start (valist, nextarg)
@@ -1966,19 +1921,6 @@ do {                                                                     \
 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
   sparc_va_arg (valist, type)
 
-/* Define this macro if the location where a function argument is passed
-   depends on whether or not it is a named argument.
-
-   This macro controls how the NAMED argument to FUNCTION_ARG
-   is set for varargs and stdarg functions.  With this macro defined,
-   the NAMED argument is always true for named arguments, and false for
-   unnamed arguments.  If this is not defined, but SETUP_INCOMING_VARARGS
-   is defined, then all arguments are treated as named.  Otherwise, all named
-   arguments except the last are treated as named.
-   For the v9 we want NAMED to mean what it says it means.  */
-
-#define STRICT_ARGUMENT_NAMING TARGET_V9
-
 /* Generate RTL to flush the register windows so as to make arbitrary frames
    available.  */
 #define SETUP_FRAME_ADDRESSES()                \
@@ -2386,9 +2328,6 @@ do {                                                                    \
    and maybe make use of that.  */
 #define SLOW_BYTE_ACCESS 1
 
-/* When a prototype says `char' or `short', really pass an `int'.  */
-#define PROMOTE_PROTOTYPES (TARGET_ARCH32)
-
 /* Define this to be nonzero if shift instructions ignore all but the low-order
    few bits.  */
 #define SHIFT_COUNT_TRUNCATED 1