diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2004-01-30 14:46:43 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2004-01-30 14:46:43 +0000 |
commit | 3e2cc1d1c78e5060da86145eecd12e05f58bf1b0 (patch) | |
tree | e14f64cb2595257ca261bd661e3159fa7251a656 /gcc/config/sparc | |
parent | 5e9295fa05762dd503c5310b0b28e3f352f876ae (diff) | |
download | gcc-3e2cc1d1c78e5060da86145eecd12e05f58bf1b0.zip gcc-3e2cc1d1c78e5060da86145eecd12e05f58bf1b0.tar.gz gcc-3e2cc1d1c78e5060da86145eecd12e05f58bf1b0.tar.bz2 |
sparc-protos.h: Remove the prototype for sparc_builtin_saveregs.
* 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
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r-- | gcc/config/sparc/sparc-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 91 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 67 |
3 files changed, 94 insertions, 67 deletions
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index 12c5d2d..35f5d51 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -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); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index e1e37ee..8beea52 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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 *); /* 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; /* 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; diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 364bea0..194fcb6 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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))) /* 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) -/* 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 |