1 /* Definitions of target machine for GNU compiler. 64 bit ABI support.
2 Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2002 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)
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
25 #define STACK_BOUNDARY \
26 ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
29 #undef MIPS_STACK_ALIGN
30 #define MIPS_STACK_ALIGN(LOC) \
31 ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
36 #define GP_ARG_LAST ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
37 ? GP_REG_FIRST + 7 : GP_REG_FIRST + 11)
39 #define FP_ARG_LAST ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
40 ? FP_REG_FIRST + 15 : FP_REG_FIRST + 19)
42 #undef SUBTARGET_CONDITIONAL_REGISTER_USAGE
43 #define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
45 /* fp20-23 are now caller saved. */ \
46 if (mips_abi == ABI_64) \
49 for (regno = FP_REG_FIRST + 20; regno < FP_REG_FIRST + 24; regno++) \
50 call_really_used_regs[regno] = call_used_regs[regno] = 1; \
52 /* odd registers from fp21 to fp31 are now caller saved. */ \
53 if (mips_abi == ABI_N32 || mips_abi == ABI_MEABI) \
56 for (regno = FP_REG_FIRST + 21; regno <= FP_REG_FIRST + 31; regno+=2) \
57 call_really_used_regs[regno] = call_used_regs[regno] = 1; \
61 #undef MAX_ARGS_IN_REGISTERS
62 #define MAX_ARGS_IN_REGISTERS ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
65 #undef REG_PARM_STACK_SPACE
66 #define REG_PARM_STACK_SPACE(FNDECL) \
67 ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
68 ? (MAX_ARGS_IN_REGISTERS*UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL) \
71 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
74 : (((MODE) == BLKmode \
75 ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
76 && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT))\
77 : (GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY \
78 && (mips_abi == ABI_32 \
79 || mips_abi == ABI_O64 \
80 || mips_abi == ABI_EABI \
81 || GET_MODE_CLASS (MODE) == MODE_INT))) \
84 /* Modified version of the macro in expr.h. */
85 #define MUST_PASS_IN_STACK(MODE,TYPE) \
87 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
88 || TREE_ADDRESSABLE (TYPE) \
89 || ((MODE) == BLKmode \
90 && mips_abi != ABI_32 && mips_abi != ABI_O64 \
91 && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
92 && 0 == (int_size_in_bytes (TYPE) \
93 % (PARM_BOUNDARY / BITS_PER_UNIT))) \
94 && (FUNCTION_ARG_PADDING (MODE, TYPE) \
95 == (BYTES_BIG_ENDIAN ? upward : downward)))))
97 #define STRICT_ARGUMENT_NAMING (mips_abi != ABI_32 && mips_abi != ABI_O64)
99 /* A C expression that indicates when an argument must be passed by
100 reference. If nonzero for an argument, a copy of that argument is
101 made in memory and a pointer to the argument is passed instead of the
102 argument itself. The pointer is passed in whatever way is appropriate
103 for passing a pointer to that type. */
104 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
105 function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED)
107 /* A C expression that indicates when it is the called function's
108 responsibility to make a copy of arguments passed by invisible
109 reference. Normally, the caller makes a copy and passes the
110 address of the copy to the routine being called. When
111 FUNCTION_ARG_CALLEE_COPIES is defined and is nonzero, the caller
112 does not make a copy. Instead, it passes a pointer to the "live"
113 value. The called function must not modify this value. If it can
114 be determined that the value won't be modified, it need not make a
115 copy; otherwise a copy must be made. */
116 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
117 (mips_abi == ABI_EABI && (NAMED) \
118 && FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED))
120 /* ??? Unimplemented stuff follows. */
122 /* ??? Add support for 16 byte/128 bit long doubles here when
123 mips_abi != ABI32. */
125 /* ??? Make main return zero if user did not specify return value. */
127 /* ??? Add support for .interfaces section, so as to get linker warnings
128 when stdarg functions called without prototype in scope? */
130 /* ??? Could optimize structure passing by putting the right register rtx
131 into the field decl, so that if we use the field, we can take the value from
132 a register instead of from memory. */