+2002-08-02 Richard Sandiford <rsandifo@redhat.com>
+
+ * config.gcc: Don't include mips/abi64.h in $tm_file.
+ * hard-reg-set.h (call_really_used_regs): Declare.
+ * config/mips/abi64.h: Remove file.
+ * config/mips/linux.h,
+ * config/mips/iris6.h: Don't include it.
+ * config/mips/mips-protos.h (mips_conditional_register_usage): Declare.
+ * config/mips/mips.h (CONDITIONAL_REGISTER_USAGE): Use it.
+ (REG_PARM_STACK_SPACE, STACK_BOUNDARY, STRICT_ARGUMENT_NAMING,
+ FUNCTION_ARG_PASS_BY_REFERENCE, FUNCTION_ARG_PADDING,
+ FUNCTION_ARG_CALLEE_COPIES, MUST_PASS_IN_STACK, MIPS_STACK_ALIGN):
+ Bring across definitions from abi64.h.
+ (GP_ARG_LAST, FP_ARG_LAST): Use MAX_ARGS_IN_REGISTERS.
+ (BIGGEST_MAX_ARGS_IN_REGISTERS): New.
+ (struct mips_args): Use it.
+ * config/mips/mips.c (mips_conditional_register_usage): Define.
+
2002-08-02 Jason Merrill <jason@redhat.com>
* langhooks-def.h (LANG_HOOKS_EXPR_SIZE): New macro.
tmake_file=mips/t-ecoff
;;
mipsisa32-*-elf* | mipsisa32el-*-elf*)
- tm_file="${tm_file} mips/elf.h mips/abi64.h"
+ tm_file="${tm_file} mips/elf.h"
tmake_file=mips/t-isa3264
tm_defines="MIPS_ISA_DEFAULT=32 MIPS_ABI_DEFAULT=ABI_MEABI"
;;
mipsisa64-*-elf* | mipsisa64el-*-elf*)
- tm_file="${tm_file} mips/elf.h mips/abi64.h"
+ tm_file="${tm_file} mips/elf.h"
tmake_file=mips/t-isa3264
target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS"
tm_defines="MIPS_ISA_DEFAULT=64 MIPS_ABI_DEFAULT=ABI_MEABI"
;;
mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*)
- tm_file="${tm_file} mips/elf.h mips/abi64.h"
+ tm_file="${tm_file} mips/elf.h"
tmake_file=mips/t-elf
target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS"
tm_defines="MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64"
fi
;;
mipstx39-*-elf* | mipstx39el-*-elf*)
- tm_file="${tm_file} mips/r3900.h mips/elf.h mips/abi64.h"
+ tm_file="${tm_file} mips/r3900.h mips/elf.h"
tmake_file=mips/t-r3900
;;
mmix-knuth-mmixware)
+++ /dev/null
-/* Definitions of target machine for GNU compiler. 64 bit ABI support.
- Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* Macros to implement the 64 bit ABI. This file is meant to be included
- after mips.h. */
-
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY \
- ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
- ? 64 : 128)
-
-#undef MIPS_STACK_ALIGN
-#define MIPS_STACK_ALIGN(LOC) \
- ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
- ? ((LOC) + 7) & ~7 \
- : ((LOC) + 15) & ~15)
-
-#undef GP_ARG_LAST
-#define GP_ARG_LAST ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
- ? GP_REG_FIRST + 7 : GP_REG_FIRST + 11)
-#undef FP_ARG_LAST
-#define FP_ARG_LAST ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
- ? FP_REG_FIRST + 15 : FP_REG_FIRST + 19)
-
-#undef SUBTARGET_CONDITIONAL_REGISTER_USAGE
-#define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
-{ \
- /* fp20-23 are now caller saved. */ \
- if (mips_abi == ABI_64) \
- { \
- int regno; \
- for (regno = FP_REG_FIRST + 20; regno < FP_REG_FIRST + 24; regno++) \
- call_really_used_regs[regno] = call_used_regs[regno] = 1; \
- } \
- /* odd registers from fp21 to fp31 are now caller saved. */ \
- if (mips_abi == ABI_N32 || mips_abi == ABI_MEABI) \
- { \
- int regno; \
- for (regno = FP_REG_FIRST + 21; regno <= FP_REG_FIRST + 31; regno+=2) \
- call_really_used_regs[regno] = call_used_regs[regno] = 1; \
- } \
-}
-
-#undef MAX_ARGS_IN_REGISTERS
-#define MAX_ARGS_IN_REGISTERS ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
- ? 4 : 8)
-
-#undef REG_PARM_STACK_SPACE
-#define REG_PARM_STACK_SPACE(FNDECL) \
- ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
- ? (MAX_ARGS_IN_REGISTERS*UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL) \
- : 0)
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- (! BYTES_BIG_ENDIAN \
- ? upward \
- : (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT))\
- : (GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY \
- && (mips_abi == ABI_32 \
- || mips_abi == ABI_O64 \
- || mips_abi == ABI_EABI \
- || GET_MODE_CLASS (MODE) == MODE_INT))) \
- ? downward : upward))
-
-/* Modified version of the macro in expr.h. */
-#define MUST_PASS_IN_STACK(MODE,TYPE) \
- ((TYPE) != 0 \
- && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
- || TREE_ADDRESSABLE (TYPE) \
- || ((MODE) == BLKmode \
- && mips_abi != ABI_32 && mips_abi != ABI_O64 \
- && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && 0 == (int_size_in_bytes (TYPE) \
- % (PARM_BOUNDARY / BITS_PER_UNIT))) \
- && (FUNCTION_ARG_PADDING (MODE, TYPE) \
- == (BYTES_BIG_ENDIAN ? upward : downward)))))
-
-#define STRICT_ARGUMENT_NAMING (mips_abi != ABI_32 && mips_abi != ABI_O64)
-
-/* A C expression that indicates when an argument must be passed by
- reference. If nonzero for an argument, a copy of that argument is
- made in memory and a pointer to the argument is passed instead of the
- argument itself. The pointer is passed in whatever way is appropriate
- for passing a pointer to that type. */
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED)
-
-/* A C expression that indicates when it is the called function's
- responsibility to make a copy of arguments passed by invisible
- reference. Normally, the caller makes a copy and passes the
- address of the copy to the routine being called. When
- FUNCTION_ARG_CALLEE_COPIES is defined and is nonzero, the caller
- does not make a copy. Instead, it passes a pointer to the "live"
- value. The called function must not modify this value. If it can
- be determined that the value won't be modified, it need not make a
- copy; otherwise a copy must be made. */
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
- (mips_abi == ABI_EABI && (NAMED) \
- && FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED))
-
-/* ??? Unimplemented stuff follows. */
-
-/* ??? Add support for 16 byte/128 bit long doubles here when
- mips_abi != ABI32. */
-
-/* ??? Make main return zero if user did not specify return value. */
-
-/* ??? Add support for .interfaces section, so as to get linker warnings
- when stdarg functions called without prototype in scope? */
-
-/* ??? Could optimize structure passing by putting the right register rtx
- into the field decl, so that if we use the field, we can take the value from
- a register instead of from memory. */
#endif
#include "mips/iris5.h"
-#include "mips/abi64.h"
/* Irix6 assembler does handle DWARF2 directives. Override setting in
irix5.h file. */
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "mips/abi64.h"
-
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
extern const char *output_block_move PARAMS ((rtx, rtx *, int,
enum block_move_type));
extern void override_options PARAMS ((void));
+extern void mips_conditional_register_usage PARAMS ((void));
extern void print_operand_address PARAMS ((FILE *, rtx));
extern void print_operand PARAMS ((FILE *, rtx, int));
extern int double_memory_operand PARAMS ((rtx,enum machine_mode));
init_machine_status = &mips_init_machine_status;
}
+/* Implement CONDITIONAL_REGISTER_USAGE. */
+
+void
+mips_conditional_register_usage ()
+{
+ if (!TARGET_HARD_FLOAT)
+ {
+ int regno;
+
+ for (regno = FP_REG_FIRST; regno <= FP_REG_LAST; regno++)
+ fixed_regs[regno] = call_used_regs[regno] = 1;
+ for (regno = ST_REG_FIRST; regno <= ST_REG_LAST; regno++)
+ fixed_regs[regno] = call_used_regs[regno] = 1;
+ }
+ else if (! ISA_HAS_8CC)
+ {
+ int regno;
+
+ /* We only have a single condition code register. We
+ implement this by hiding all the condition code registers,
+ and generating RTL that refers directly to ST_REG_FIRST. */
+ for (regno = ST_REG_FIRST; regno <= ST_REG_LAST; regno++)
+ fixed_regs[regno] = call_used_regs[regno] = 1;
+ }
+ /* In mips16 mode, we permit the $t temporary registers to be used
+ for reload. We prohibit the unused $s registers, since they
+ are caller saved, and saving them via a mips16 register would
+ probably waste more time than just reloading the value. */
+ if (TARGET_MIPS16)
+ {
+ fixed_regs[18] = call_used_regs[18] = 1;
+ fixed_regs[19] = call_used_regs[19] = 1;
+ fixed_regs[20] = call_used_regs[20] = 1;
+ fixed_regs[21] = call_used_regs[21] = 1;
+ fixed_regs[22] = call_used_regs[22] = 1;
+ fixed_regs[23] = call_used_regs[23] = 1;
+ fixed_regs[26] = call_used_regs[26] = 1;
+ fixed_regs[27] = call_used_regs[27] = 1;
+ fixed_regs[30] = call_used_regs[30] = 1;
+ }
+ /* fp20-23 are now caller saved. */
+ if (mips_abi == ABI_64)
+ {
+ int regno;
+ for (regno = FP_REG_FIRST + 20; regno < FP_REG_FIRST + 24; regno++)
+ call_really_used_regs[regno] = call_used_regs[regno] = 1;
+ }
+ /* odd registers from fp21 to fp31 are now caller saved. */
+ if (mips_abi == ABI_N32 || mips_abi == ABI_MEABI)
+ {
+ int regno;
+ for (regno = FP_REG_FIRST + 21; regno <= FP_REG_FIRST + 31; regno+=2)
+ call_really_used_regs[regno] = call_used_regs[regno] = 1;
+ }
+}
+
/* Allocate a chunk of memory for per-function machine-dependent data. */
static struct machine_function *
mips_init_machine_status ()
/* Recast the cpu class to be the cpu attribute. */
#define mips_cpu_attr ((enum attr_cpu)mips_tune)
-/* Which ABI to use. These are constants because abi64.h must check their
- value at preprocessing time.
-
- ABI_32 (original 32, or o32), ABI_N32 (n32), ABI_64 (n64) are all
- defined by SGI. ABI_O64 is o32 extended to work on a 64 bit machine. */
+/* Which ABI to use. ABI_32 (original 32, or o32), ABI_N32 (n32),
+ ABI_64 (n64) are all defined by SGI. ABI_O64 is o32 extended
+ to work on a 64 bit machine. */
#define ABI_32 0
#define ABI_N32 1
#define OVERRIDE_OPTIONS override_options ()
-/* Zero or more C statements that may conditionally modify two
- variables `fixed_regs' and `call_used_regs' (both of type `char
- []') after they have been initialized from the two preceding
- macros.
-
- This is necessary in case the fixed or call-clobbered registers
- depend on target flags.
-
- You need not define this macro if it has no work to do.
-
- If the usage of an entire class of registers depends on the target
- flags, you may indicate this to GCC by using this macro to modify
- `fixed_regs' and `call_used_regs' to 1 for each of the registers in
- the classes which should not be used by GCC. Also define the macro
- `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called with a
- letter for a class that shouldn't be used.
-
- (However, if this class is not included in `GENERAL_REGS' and all
- of the insn patterns whose constraints permit this class are
- controlled by target switches, then GCC will automatically avoid
- using these registers when the target switches are opposed to
- them.) */
-
-#define CONDITIONAL_REGISTER_USAGE \
-do \
- { \
- if (!TARGET_HARD_FLOAT) \
- { \
- int regno; \
- \
- for (regno = FP_REG_FIRST; regno <= FP_REG_LAST; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- for (regno = ST_REG_FIRST; regno <= ST_REG_LAST; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- else if (! ISA_HAS_8CC) \
- { \
- int regno; \
- \
- /* We only have a single condition code register. We \
- implement this by hiding all the condition code registers, \
- and generating RTL that refers directly to ST_REG_FIRST. */ \
- for (regno = ST_REG_FIRST; regno <= ST_REG_LAST; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- /* In mips16 mode, we permit the $t temporary registers to be used \
- for reload. We prohibit the unused $s registers, since they \
- are caller saved, and saving them via a mips16 register would \
- probably waste more time than just reloading the value. */ \
- if (TARGET_MIPS16) \
- { \
- fixed_regs[18] = call_used_regs[18] = 1; \
- fixed_regs[19] = call_used_regs[19] = 1; \
- fixed_regs[20] = call_used_regs[20] = 1; \
- fixed_regs[21] = call_used_regs[21] = 1; \
- fixed_regs[22] = call_used_regs[22] = 1; \
- fixed_regs[23] = call_used_regs[23] = 1; \
- fixed_regs[26] = call_used_regs[26] = 1; \
- fixed_regs[27] = call_used_regs[27] = 1; \
- fixed_regs[30] = call_used_regs[30] = 1; \
- } \
- SUBTARGET_CONDITIONAL_REGISTER_USAGE \
- } \
-while (0)
-
-/* This is meant to be redefined in the host dependent files. */
-#define SUBTARGET_CONDITIONAL_REGISTER_USAGE
+#define CONDITIONAL_REGISTER_USAGE mips_conditional_register_usage ()
/* Show we can debug even without a frame pointer. */
#define CAN_DEBUG_WITHOUT_FP
in register. In case an argument list is of form GF used registers
are a0 (a2,a3), but we should push over a1... */
-#define REG_PARM_STACK_SPACE(FNDECL) \
- ((MAX_ARGS_IN_REGISTERS*UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL))
+#define REG_PARM_STACK_SPACE(FNDECL) \
+ ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
+ ? (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL) \
+ : 0)
/* Define this if it is the responsibility of the caller to
allocate the area reserved for arguments passed in registers.
`current_function_outgoing_args_size'. */
#define OUTGOING_REG_PARM_STACK_SPACE
-/* Align stack frames on 64 bits (Double Word ). */
-#ifndef STACK_BOUNDARY
-#define STACK_BOUNDARY 64
-#endif
+#define STACK_BOUNDARY \
+ ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
+ ? 64 : 128)
/* Make sure 4 words are always allocated on the stack. */
#define GP_RETURN (GP_REG_FIRST + 2)
#define FP_RETURN ((TARGET_SOFT_FLOAT) ? GP_RETURN : (FP_REG_FIRST + 0))
+#define MAX_ARGS_IN_REGISTERS \
+ ((mips_abi == ABI_32 || mips_abi == ABI_O64) ? 4 : 8)
+
+/* Largest possible value of MAX_ARGS_IN_REGISTERS. */
+
+#define BIGGEST_MAX_ARGS_IN_REGISTERS 8
+
/* Symbolic macros for the first/last argument registers. */
#define GP_ARG_FIRST (GP_REG_FIRST + 4)
-#define GP_ARG_LAST (GP_REG_FIRST + 7)
+#define GP_ARG_LAST (GP_ARG_FIRST + MAX_ARGS_IN_REGISTERS - 1)
#define FP_ARG_FIRST (FP_REG_FIRST + 12)
-#define FP_ARG_LAST (FP_REG_FIRST + 15)
-
-#define MAX_ARGS_IN_REGISTERS 4
+#define FP_ARG_LAST (FP_ARG_FIRST + MAX_ARGS_IN_REGISTERS - 1)
/* Define how to find the value returned by a library function
assuming the value has mode MODE. Because we define
#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
\f
+#define STRICT_ARGUMENT_NAMING (mips_abi != ABI_32 && mips_abi != ABI_O64)
+
/* Define a data type for recording info about an argument list
during the scan of that argument list. This data type should
hold all necessary information about the function itself
the shift patterns, and function_arg, which returns them when given
a VOIDmode argument. */
unsigned int num_adjusts;
- rtx adjust[MAX_ARGS_IN_REGISTERS];
+ rtx adjust[BIGGEST_MAX_ARGS_IN_REGISTERS];
} CUMULATIVE_ARGS;
/* Initialize a variable CUM of type CUMULATIVE_ARGS
? PARM_BOUNDARY \
: GET_MODE_ALIGNMENT(MODE)))
+#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
+ function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED)
+
+#define FUNCTION_ARG_PADDING(MODE, TYPE) \
+ (! BYTES_BIG_ENDIAN \
+ ? upward \
+ : (((MODE) == BLKmode \
+ ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
+ && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT))\
+ : (GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY \
+ && (mips_abi == ABI_32 \
+ || mips_abi == ABI_O64 \
+ || mips_abi == ABI_EABI \
+ || GET_MODE_CLASS (MODE) == MODE_INT))) \
+ ? downward : upward))
+
+#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
+ (mips_abi == ABI_EABI && (NAMED) \
+ && FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED))
+
+/* Modified version of the macro in expr.h. */
+#define MUST_PASS_IN_STACK(MODE,TYPE) \
+ ((TYPE) != 0 \
+ && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
+ || TREE_ADDRESSABLE (TYPE) \
+ || ((MODE) == BLKmode \
+ && mips_abi != ABI_32 && mips_abi != ABI_O64 \
+ && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
+ && 0 == (int_size_in_bytes (TYPE) \
+ % (PARM_BOUNDARY / BITS_PER_UNIT))) \
+ && (FUNCTION_ARG_PADDING (MODE, TYPE) \
+ == (BYTES_BIG_ENDIAN ? upward : downward)))))
+
/* True if using EABI and varargs can be passed in floating-point
registers. Under these conditions, we need a more complex form
of va_list, which tracks GPR, FPR and stack arguments separately. */
|| (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) \
|| (regno == (GP_REG_FIRST + 31) && regs_ever_live[GP_REG_FIRST + 31]))
-/* ALIGN FRAMES on double word boundaries */
-#ifndef MIPS_STACK_ALIGN
-#define MIPS_STACK_ALIGN(LOC) (((LOC) + 7) & ~7)
-#endif
+/* Treat LOC as a byte offset from the stack pointer and round it up
+ to the next fully-aligned offset. */
+#define MIPS_STACK_ALIGN(LOC) \
+ ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
+ ? ((LOC) + 7) & ~7 \
+ : ((LOC) + 15) & ~15)
\f
/* Define the `__builtin_va_list' type for the ABI. */
extern char call_used_regs[FIRST_PSEUDO_REGISTER];
+#ifdef CALL_REALLY_USED_REGISTERS
+extern char call_really_used_regs[];
+#endif
+
/* The same info as a HARD_REG_SET. */
extern HARD_REG_SET call_used_reg_set;