hppa_builtin_saveregs. Add a prototype for
pa_return_in_memory.
* config/pa/pa.c (TARGET_PROMOTE_FUNCTION_RETURN): New.
(TARGET_PROMOTE_PROTOTYPES): Likewise.
(TARGET_STRUCT_VALUE_RTX): Likewise.
(TARGET_RETURN_IN_MEMORY): Likewise.
(TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise.
(pa_struct_value_rtx): Likewise.
(pa_return_in_memory): Likewise.
* config/pa/pa.h (STRUCT_VALUE_REGNUM): Rename to
PA_STRUCT_VALUE_REGNUM.
(INIT_CUMULATIVE_ARGS): Use pa_return_in_memory.
(EXPAND_BUILTIN_SAVEREGS): Remove.
(PROMOTE_PROTOTYPES): Likewise.
(PROMOTE_FUNCTION_RETURN): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76600
138bc75d-0d04-0410-961f-
82ee72b054a4
2004-01-25 Kazu Hirata <kazu@cs.umass.edu>
+ * config/pa/pa-protos.h: Remove the prototype for
+ hppa_builtin_saveregs. Add a prototype for
+ pa_return_in_memory.
+ * config/pa/pa.c (TARGET_PROMOTE_FUNCTION_RETURN): New.
+ (TARGET_PROMOTE_PROTOTYPES): Likewise.
+ (TARGET_STRUCT_VALUE_RTX): Likewise.
+ (TARGET_RETURN_IN_MEMORY): Likewise.
+ (TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise.
+ (pa_struct_value_rtx): Likewise.
+ (pa_return_in_memory): Likewise.
+ * config/pa/pa.h (STRUCT_VALUE_REGNUM): Rename to
+ PA_STRUCT_VALUE_REGNUM.
+ (INIT_CUMULATIVE_ARGS): Use pa_return_in_memory.
+ (EXPAND_BUILTIN_SAVEREGS): Remove.
+ (PROMOTE_PROTOTYPES): Likewise.
+ (PROMOTE_FUNCTION_RETURN): Likewise.
+
+2004-01-25 Kazu Hirata <kazu@cs.umass.edu>
+
* config/vax/vax.c (TARGET_PROMOTE_PROTOTYPES): New.
(TARGET_STRUCT_VALUE_RTX): Likewise.
(vax_struct_value_rtx): Likewise.
/* Prototype function used in macro CONST_OK_FOR_LETTER_P. */
extern int zdepi_cint_p (unsigned HOST_WIDE_INT);
-extern struct rtx_def *hppa_builtin_saveregs (void);
-
extern void override_options (void);
extern void output_ascii (FILE *, const char *, int);
extern HOST_WIDE_INT compute_frame_size (HOST_WIDE_INT, int *);
extern int function_arg_partial_nregs (CUMULATIVE_ARGS *,
enum machine_mode,
tree, int);
+extern bool pa_return_in_memory (tree, tree);
#endif /* TREE_CODE */
static void pa_asm_out_destructor (rtx, int);
#endif
static void pa_init_builtins (void);
+static rtx hppa_builtin_saveregs (void);
static void copy_fp_args (rtx) ATTRIBUTE_UNUSED;
static int length_fp_args (rtx) ATTRIBUTE_UNUSED;
static struct deferred_plabel *get_plabel (const char *)
#ifdef HPUX_LONG_DOUBLE_LIBRARY
static void pa_hpux_init_libfuncs (void);
#endif
+static rtx pa_struct_value_rtx (tree, int);
/* Save the operands last given to a compare for use when we
generate a scc or bcc insn. */
#define TARGET_INIT_LIBFUNCS pa_hpux_init_libfuncs
#endif
+#undef TARGET_PROMOTE_FUNCTION_RETURN
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#undef TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX pa_struct_value_rtx
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY pa_return_in_memory
+
+#undef TARGET_EXPAND_BUILTIN_SAVEREGS
+#define TARGET_EXPAND_BUILTIN_SAVEREGS hppa_builtin_saveregs
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
void
to determine if stdargs or varargs is used and fill in an initial
va_list. A pointer to this constructor is returned. */
-struct rtx_def *
+static rtx
hppa_builtin_saveregs (void)
{
rtx offset, dest;
the mode is SF or DF. Then the value is returned in fr4 (32).
This must perform the same promotions as PROMOTE_MODE, else
- PROMOTE_FUNCTION_RETURN will not work correctly.
+ TARGET_PROMOTE_FUNCTION_RETURN will not work correctly.
Small structures must be returned in a PARALLEL on PA64 in order
to match the HP Compiler ABI. */
fputs (",DATA\n", stream);
}
}
+
+static rtx
+pa_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
+ int incoming ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (Pmode, PA_STRUCT_VALUE_REGNUM);
+}
+
+bool
+pa_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+ /* SOM ABI says that objects larger than 64 bits are returned in memory.
+ PA64 ABI says that objects larger than 128 bits are returned in memory.
+ Note, int_size_in_bytes can return -1 if the size of the object is
+ variable or larger than the maximum value that can be expressed as
+ a HOST_WIDE_INT. It can also return zero for an empty type. The
+ simplest way to handle variable and empty types is to pass them in
+ memory. This avoids problems in defining the boundaries of argument
+ slots, allocating registers, etc. */
+ return (int_size_in_bytes (type) > (TARGET_64BIT ? 16 : 8)
+ || int_size_in_bytes (type) <= 0);
+}
+
#include "gt-pa.h"
#define DEFAULT_PCC_STRUCT_RETURN 0
-/* SOM ABI says that objects larger than 64 bits are returned in memory.
- PA64 ABI says that objects larger than 128 bits are returned in memory.
- Note, int_size_in_bytes can return -1 if the size of the object is
- variable or larger than the maximum value that can be expressed as
- a HOST_WIDE_INT. It can also return zero for an empty type. The
- simplest way to handle variable and empty types is to pass them in
- memory. This avoids problems in defining the boundaries of argument
- slots, allocating registers, etc. */
-#define RETURN_IN_MEMORY(TYPE) \
- (int_size_in_bytes (TYPE) > (TARGET_64BIT ? 16 : 8) \
- || int_size_in_bytes (TYPE) <= 0)
-
/* Register in which address to store a structure value
is passed to a function. */
-#define STRUCT_VALUE_REGNUM 28
+#define PA_STRUCT_VALUE_REGNUM 28
/* Describe how we implement __builtin_eh_return. */
#define EH_RETURN_DATA_REGNO(N) \
(CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
+ (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
- || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
+ || pa_return_in_memory (TREE_TYPE (FNTYPE), 0))) \
: 0)
#define TRAMPOLINE_ADJUST_ADDRESS(ADDR) \
if (!TARGET_64BIT) (ADDR) = memory_address (Pmode, plus_constant ((ADDR), 46))
-/* Emit code for a call to builtin_saveregs. We must emit USE insns which
- reference the 4 integer arg registers and 4 fp arg registers.
- Ordinarily they are not call used registers, but they are for
- _builtin_saveregs, so we must make this explicit. */
-
-#define EXPAND_BUILTIN_SAVEREGS() hppa_builtin_saveregs ()
-
/* Implement `va_start' for varargs and stdarg. */
#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
is done just by pretending it is already truncated. */
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES 1
-#define PROMOTE_FUNCTION_RETURN 1
-
/* Specify the machine mode that pointers have.
After generation of rtl, the compiler makes no further distinction
between pointers and any other objects of this machine mode. */