xref: /netbsd-src/external/gpl3/gcc/dist/gcc/config/mips/sde.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 /* Definitions of target machine for GNU compiler.
2    MIPS SDE version.
3    Copyright (C) 2003-2013 Free Software Foundation, Inc.
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11 
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20 
21 #undef DRIVER_SELF_SPECS
22 #define DRIVER_SELF_SPECS						\
23   /* Make sure a -mips option is present.  This helps us to pick	\
24      the right multilib, and also makes the later specs easier		\
25      to write.  */							\
26   MIPS_ISA_LEVEL_SPEC,							\
27 									\
28   /* Infer the default float setting from -march.  */			\
29   MIPS_ARCH_FLOAT_SPEC,							\
30 									\
31   /* If no ABI option is specified, infer one from the ISA level	\
32      or -mgp setting.  */						\
33   "%{!mabi=*: %{" MIPS_32BIT_OPTION_SPEC ": -mabi=32;: -mabi=n32}}",	\
34 									\
35   /* Remove a redundant -mfp64 for -mabi=n32; we want the !mfp64	\
36      multilibs.  There's no need to check whether the architecture	\
37      is 64-bit; cc1 will complain if it isn't.  */			\
38   "%{mabi=n32: %<mfp64}",						\
39 									\
40   /* Make sure that an endian option is always present.  This makes	\
41      things like LINK_SPEC easier to write.  */				\
42   "%{!EB:%{!EL:%(endian_spec)}}",					\
43 									\
44   /* Configuration-independent MIPS rules.  */				\
45   BASE_DRIVER_SELF_SPECS
46 
47 /* Use trap rather than break for all but MIPS I ISA.  Force -no-mips16,
48    so that MIPS16 assembler code requires an explicit ".set mips16".
49    Very little hand-written MIPS16 assembler exists, and some build
50    systems expect code to be assembled as non-MIPS16 even if the
51    prevailing compiler flags select -mips16.  */
52 #undef SUBTARGET_ASM_SPEC
53 #define SUBTARGET_ASM_SPEC "\
54 %{!mips1:--trap} \
55 %{mips16:-no-mips16}"
56 
57 #undef LINK_SPEC
58 #define LINK_SPEC "\
59 %(endian_spec) \
60 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
61 %{shared} \
62 %{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
63 %{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
64 %{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"
65 
66 #undef DEFAULT_SIGNED_CHAR
67 #define DEFAULT_SIGNED_CHAR 0
68 
69 /* Describe how we implement __builtin_eh_return.  */
70 
71 /* At the moment, nothing appears to use more than 2 EH data registers.
72    The chosen registers must not clash with the return register ($2),
73    EH_RETURN_STACKADJ ($3), or MIPS_EPILOGUE_TEMP ($5), and they must
74    be general MIPS16 registers.  Pick $6 and $7.  */
75 #undef EH_RETURN_DATA_REGNO
76 #define EH_RETURN_DATA_REGNO(N) \
77   ((N) < 2 ? 7 - (N) : INVALID_REGNUM)
78 
79 /* Use $5 as a temporary for both MIPS16 and non-MIPS16.  */
80 #undef MIPS_EPILOGUE_TEMP_REGNUM
81 #define MIPS_EPILOGUE_TEMP_REGNUM \
82   (cfun->machine->interrupt_handler_p ? K0_REG_NUM : GP_REG_FIRST + 5)
83 
84 /* Using long will always be right for size_t and ptrdiff_t, since
85    sizeof(long) must equal sizeof(void *), following from the setting
86    of the -mlong64 option.  */
87 #undef SIZE_TYPE
88 #define SIZE_TYPE "long unsigned int"
89 #undef PTRDIFF_TYPE
90 #define PTRDIFF_TYPE "long int"
91 
92 /* Use standard ELF-style local labels (not '$' as on early Irix).  */
93 #undef LOCAL_LABEL_PREFIX
94 #define LOCAL_LABEL_PREFIX "."
95 
96 /* Use periods rather than dollar signs in special g++ assembler names.  */
97 #define NO_DOLLAR_IN_LABEL
98 
99 /* Currently we don't support 128bit long doubles, so for now we force
100    n32 to be 64bit.  */
101 #undef LONG_DOUBLE_TYPE_SIZE
102 #define LONG_DOUBLE_TYPE_SIZE 64
103 
104 #ifdef IN_LIBGCC2
105 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
106 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
107 #endif
108 
109 /* Force all .init and .fini entries to be 32-bit, not mips16, so that
110    in a mixed environment they are all the same mode. The crti.asm and
111    crtn.asm files will also be compiled as 32-bit due to the
112    -no-mips16 flag in SUBTARGET_ASM_SPEC above. */
113 #undef CRT_CALL_STATIC_FUNCTION
114 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
115    asm (SECTION_OP "\n\
116 	.set push\n\
117 	.set nomips16\n\
118 	jal " USER_LABEL_PREFIX #FUNC "\n\
119 	.set pop\n\
120 	" TEXT_SECTION_ASM_OP);
121