Don't define EMPTY_FIELD_BOUNDARY
[official-gcc.git] / gcc / config / mips / abi64.h
blob9e1a4b98537ef5e35c0fd32d46fe6c8d124dc2af
1 /* Definitions of target machine for GNU compiler. 64 bit ABI support.
2 Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Macros to implement the 64 bit ABI. This file is meant to be included
22 after mips.h. */
24 #undef SUBTARGET_TARGET_OPTIONS
25 #define SUBTARGET_TARGET_OPTIONS\
26 { "abi=", &mips_abi_string },
28 #undef STACK_BOUNDARY
29 #define STACK_BOUNDARY (mips_abi == ABI_32 ? 64 : 128)
31 #undef MIPS_STACK_ALIGN
32 #define MIPS_STACK_ALIGN(LOC) \
33 (mips_abi == ABI_32 ? ((LOC)+7) & ~7 : ((LOC)+15) & ~15)
35 #undef GP_ARG_LAST
36 #define GP_ARG_LAST (mips_abi == ABI_32 ? GP_REG_FIRST + 7 : GP_REG_FIRST + 11)
37 #undef FP_ARG_LAST
38 #define FP_ARG_LAST (mips_abi == ABI_32 ? FP_REG_FIRST + 15 : FP_REG_FIRST + 19)
40 #undef SUBTARGET_CONDITIONAL_REGISTER_USAGE
41 #define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
42 { \
43 /* fp20-23 are now caller saved. */ \
44 if (mips_abi == ABI_64) \
45 { \
46 int regno; \
47 for (regno = FP_REG_FIRST + 20; regno < FP_REG_FIRST + 24; regno++) \
48 call_used_regs[regno] = 1; \
49 } \
50 /* odd registers from fp21 to fp31 are now caller saved. */ \
51 if (mips_abi == ABI_N32) \
52 { \
53 int regno; \
54 for (regno = FP_REG_FIRST + 21; regno <= FP_REG_FIRST + 31; regno+=2) \
55 call_used_regs[regno] = 1; \
56 } \
59 #undef MAX_ARGS_IN_REGISTERS
60 #define MAX_ARGS_IN_REGISTERS (mips_abi == ABI_32 ? 4 : 8)
62 #undef REG_PARM_STACK_SPACE
63 #if 0
64 /* ??? This is necessary in order for the ABI_32 support to work. However,
65 expr.c (emit_push_insn) has no support for a REG_PARM_STACK_SPACE
66 definition that returns zero. That would have to be fixed before this
67 can be enabled. */
68 #define REG_PARM_STACK_SPACE(FNDECL) \
69 (mips_abi == ABI_32 \
70 ? (MAX_ARGS_IN_REGISTERS*UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL) \
71 : 0)
72 #endif
74 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
75 (! BYTES_BIG_ENDIAN \
76 ? upward \
77 : (((MODE) == BLKmode \
78 ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
79 && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT))\
80 : (GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY \
81 && (mips_abi == ABI_32 || GET_MODE_CLASS (MODE) == MODE_INT)))\
82 ? downward : upward))
84 #undef RETURN_IN_MEMORY
85 #define RETURN_IN_MEMORY(TYPE) \
86 (mips_abi == ABI_32 \
87 ? TYPE_MODE (TYPE) == BLKmode : int_size_in_bytes (TYPE) > 16)
89 extern struct rtx_def *mips_function_value ();
90 #undef FUNCTION_VALUE
91 #define FUNCTION_VALUE(VALTYPE, FUNC) mips_function_value (VALTYPE, FUNC)
93 /* For varargs, we must save the current argument, because it is the fake
94 argument va_alist, and will need to be converted to the real argument.
95 For stdarg, we do not need to save the current argument, because it
96 is a real argument. */
97 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
98 { if (mips_abi != ABI_32 \
99 && ((CUM).arg_words \
100 < (MAX_ARGS_IN_REGISTERS - ! current_function_varargs))) \
102 PRETEND_SIZE \
103 = (MAX_ARGS_IN_REGISTERS - (CUM).arg_words \
104 - ! current_function_varargs) * UNITS_PER_WORD; \
106 if (! (NO_RTL)) \
108 rtx mem = gen_rtx (MEM, BLKmode, virtual_incoming_args_rtx); \
109 /* va_arg is an array access in this case, which causes it to \
110 get MEM_IN_STRUCT_P set. We must set it here so that the \
111 insn scheduler won't assume that these stores can't \
112 possibly overlap with the va_arg loads. */ \
113 if (BYTES_BIG_ENDIAN) \
114 MEM_IN_STRUCT_P (mem) = 1; \
115 move_block_from_reg \
116 ((CUM).arg_words + GP_ARG_FIRST + ! current_function_varargs, \
117 mem, \
118 (MAX_ARGS_IN_REGISTERS - (CUM).arg_words \
119 - ! current_function_varargs), \
120 PRETEND_SIZE); \
125 /* ??? Should disable for mips_abi == ABI32. */
126 #define STRICT_ARGUMENT_NAMING
128 /* ??? Unimplemented stuff follows. */
130 /* ??? Add support for 16 byte/128 bit long doubles here when
131 mips_abi != ABI32. */
133 /* ??? Make main return zero if user did not specify return value. */
135 /* ??? Add support for .interfaces section, so as to get linker warnings
136 when stdarg functions called without prototype in scope? */
138 /* ??? Could optimize structure passing by putting the right register rtx
139 into the field decl, so that if we use the field, we can take the value from
140 a register instead of from memory. */